Рубрики
network \ сеть

ipv6 dhcp / debian / batman / ovs / radvd / isc-dhcp-server / dnsmasq / bind9

ссылки:

https://www.isc.org/dhcp/
https://wiki.debian.org/DHCP_Server
https://wiki.debian.org/IPv6PrefixDelegation
https://wiki.debian.org/NetworkConfiguration
https://wiki.debian.org/ru/NetworkConfiguration
https://subatomicsolutions.org/8-freebsd/17-ipv4-ipv6-isc-dhcp-server-on-a-dual-stack-network

client interfaces

auto enp1s0
iface enp1s0 inet manual
             up batctl ra BATMAN_V
             up batctl if add enp1s0
             up batctl mff 1
 
auto enp7s0
iface enp7s0 inet manual
             up batctl if add enp7s0

auto bat0
iface bat0 inet manual

auto br0
iface br0 inet manual

auto dhcp-client
iface dhcp-client inet dhcp

auto dhcp-client6
iface dhcp-client6 inet6 dhcp
                   accept_ra 2
                   request_prefix 1 

server interfaces

auto enp1s0
iface enp1s0 inet dhcp

auto enp1s0
iface enp1s0 inet manual
             up batctl ra BATMAN_V
             up batctl if add enp1s0
             up batctl mff 1
  
auto enp7s0
iface enp7s0 inet manual
             up batctl if add enp7s0

auto bat0
iface bat0 inet manual


auto br0
iface br0 inet manual

auto dhcp-server
iface dhcp-server inet static
                  address 10.50.50.1/24
iface dhcp-server inet6 static
                  address 2002:db:a::1/64

ovs

ovs-vsctl show 
--------------
111dac72-04b7-4806-a881-7e057d6e3e34
    Bridge ovsbr0
        Port ovsbr0
            Interface ovsbr0
                type: internal
        Port dhcp-client6
            Interface dhcp-client6
                type: internal
        Port dhcp-client
            Interface dhcp-client
                type: internal
        Port bat0
            Interface bat0
    ovs_version: "2.15.0"
--------------

ovs-vsctl add-br ovsbr0
ovs-vsctl add-port ovsbr0 bat0
ovs-vsctl add-port ovsbr0 dhcp-client -- set interface dhcp-client type=internal
ovs-vsctl add-port ovsbr0 dhcp-client6 -- set interface dhcp-client6 type=internal



ovs-vsctl show 
--------------
111dac72-04b7-4806-a881-7e057d6e3e34
    Bridge ovsbr0
        Port ovsbr0
            Interface br0
                type: internal
        Port dhcp-server
            Interface dhcp-server
                type: internal
        Port bat0
            Interface bat0
    ovs_version: "2.15.0"
--------------


ovs-vsctl add-br ovsbr0
ovs-vsctl add-port ovsbr0 bat0
ovs-vsctl add-port ovsbr0 dhcp-server -- set interface dhcp-server type=internal

isc-dhcp-server


vim /etc/default/isc-dhcp-server
--------------------------------
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf 
DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf 
DHCPDv4_PID=/var/run/dhcpd.pid 
DHCPDv6_PID=/var/run/dhcpd6.pid 
INTERFACESv4="dhcp-server" 
INTERFACESv6="dhcp-server"
--------------------------------


cat /etc/dhcp/dhcpd.conf
------------------------
authorative;
ddns-update-style none;
option domain-name "mesh.inc";
option domain-name-servers 10.50.50.1;
option routers 10.50.50.1;
default-lease-time 600;
max-lease-time 7200;
#authoritative;
log-facility local7;

subnet 10.50.50.0 netmask 255.255.255.0 {
    range 10.50.50.100 10.50.50.200;
}
------------------------



cat /etc/dhcp/dhcpd6.conf
------------------------
authorative;
default-lease-time 1200;
max-lease-time 7200;

option dhcp6.domain-search "mesh.inc";
option dhcp6.name-servers  2002:db:a::1;

log-facility local7;

subnet6 2002:db:a::/64 {
    range6 2002:db:a::100 2002:db:a::300;
}
------------------------


radvd

vim  /etc/radvd.conf
--------------------
interface dhcp-server
{
  AdvSendAdvert on;
  MaxRtrAdvInterval 30;

  prefix 2002:db:a::1/64
  {
    AdvOnLink on;
    AdvAutonomous on;
    AdvRouterAddr off;
    AdvValidLifetime 300;
    AdvPreferredLifetime 120;
  };
};
--------------------

dnsmasq / off dns

!!! Естественно dnsmasq не может работать вместе с isc-dhcp-server/radvd
vim /etc/dnsmasq.conf
---------------------

#interface=ovsbr0
#listen-address=10.10.10.1
#dhcp-range=10.10.10.2,10.10.10.254,255.255.255.0,12h


port=0 #dns off
interface=dhcp-server
enable-ra
dhcp-range=192.168.25.2,192.168.25.150,255.255.255.0,12h
#dhcp-host=80:15:AA:BB:CC:DD,192.168.0.10
dhcp-range=d::2, d::ffff:ffff:ffff:ffff, 64, 12h
dhcp-range=d::2, slaac, 64, 12h
dhcp-range=d::2, ra-only, 64, 12h
---------------------



bind

cd /etc/bind/

cat 10.50.50.in-addr.arpa.zone
------------------------------
$TTL 30
$ORIGIN 10.50.50.in-addr.arpa.
@ SOA b1-node.mesh.inc. root.b1-node.mesh.inc. (
20120200
1h
10m
1d
30 )

  NS b1-node.mesh.inc.

1 PTR b1-node.mesh.inc.
;20 PTR win2003.mesh.inc.
;30 PTR win2008.mesh.inc.
;120 PTR winxp.mesh.inc.
------------------------------

cat mesh.inc.zone
----------------- 
$TTL 30
$ORIGIN mesh.inc.
@ SOA b1-node root 2022040801 1h 10m 1d 30
  NS b1-node
  MX 10 b1-node
 
b1-node A 10.50.50.1
;winxp A 10.10.10.120
;win2003 A 10.10.10.20
;win2008 A 10.10.10.30
-----------------


cat named.conf.options
----------------------
options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable 
        // nameservers, you probably want to use them as forwarders.  
        // Uncomment the following block, and insert the addresses replacing 
        // the all-0's placeholder.

        forwarders {
                192.168.1.1;
                8.8.8.8;
                8.8.4.4;         
         };

        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================
        dnssec-validation auto;

        listen-on-v6 { none; };
};
----------------------


cat named.conf.local
--------------------
//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";


zone "mesh.inc" {
type master;
file "/etc/bind/mesh.inc.zone";
allow-transfer { 127.0.0.1 ; };
};
 
zone "10.50.50.in-addr.arpa" {
type master;
file "/etc/bind/10.50.50.in-addr.arpa.zone";
};
--------------------