如果你的DHCP服務只監聽一個網卡,這個網卡綁定多個IP,比如 192.168.0.1,192.168.1.1
而想要DHCP同時可以分配2個網段的IP請求,像下面這樣的配置(dhcpd.conf)
subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.100 192.168.0.200 ; option routers 192.168.0.1 ; option domain-name-servers 192.168.2.1,202.112.31.58 ; } subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.2.200 ; option routers 192.168.1.1 ; option domain-name-servers 192.168.2.1,202.112.31.58 ; } |
shared-network network_tag { ... } |
Client Area A -----Switch -----VLAN 1-----------, Client Area B -----Switch -----VLAN 2-------- Switch ----Trunk --- DHCP Server Client Area C -----Switch -----VLAN 3-----------' |
1:/etc/network/interface auto eth0 iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.254 auto eth0:0 iface eth0:0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.1.254 2:/etc/dhcpd.conf default-lease-time 21600; max-lease-time 21600; option domain-name-servers 222.92.109.230,61.177.7.1,61.147.37.1; option domain-name "glfsoft.com"; shared-network network_tag { subnet 192.168.0.0 netmask 255.255.255.0 { # range 192.168.0.21 192.168.0.31; option broadcast-address 192.168.0.255; option subnet-mask 255.255.255.0; option routers 192.168.0.254; next-server 192.168.0.254; host kook { hardware ethernet 00:1A:4B:58:36:9D; fixed-address 192.168.0.9; } } subnet 192.168.1.0 netmask 255.255.255.0 { # range 192.168.1.21 192.168.1.31; option broadcast-address 192.168.1.255; option subnet-mask 255.255.255.0; option routers 192.168.1.254; next-server 192.168.1.254; host kook2 { hardware ethernet 00:E0:A0:11:BE:21; fixed-address 192.168.1.9; } } } |
(責任編輯:A6)
[火星人 ] Linux操作系統下單網卡分配多網段的方法已經有1508次圍觀