分页: 1 / 1

ubuntu如何设置多作用域

发表于 : 2016-11-14 17:32
lilycn
环境:一台Ubuntu 14.04 Linux server,三张网卡,现在想实现的是可以配置DHCP server ,实现192.168.24.0-192.168.24.200;
111.111.1.10-111.111.1.200;111.111.2.10-111.111.2.200这三个网段的配置。我如果只设置一个网段可以实现,但是直接配置多个就会dhcp server启动不了,求解啊?大神,不知道哪里错了,因为我没外网,看不了log

Re: ubuntu如何设置多作用域

发表于 : 2016-11-15 7:20
poloshiao
https://help.ubuntu.com/community/dhcp3 ... interfaces
dhcp3-server and multiple interfaces
multiple interfaces example

Re: ubuntu如何设置多作用域

发表于 : 2016-11-21 17:21
lilycn
按照此文档设置,还是只能分配到一个网段的IP地址,我怎么才能分配到另外两个网段的IP呢,求助

Re: ubuntu如何设置多作用域

发表于 : 2016-11-21 17:56
poloshiao
还是只能分配到一个网段的IP地址,我怎么才能分配到另外两个网段的IP呢,
把下面指令 複製 貼進終端機 執行
0. uname -a
1. sudo lspci -knn
2. sudo lshw -numeric -class network
3. sudo ifconfig -a
4. sudo route -nv
5. sudo dhclient -v
6. sudo cat /etc/network/interfaces
7. sudo cat /etc/NetworkManager/NetworkManager.conf
8. sudo nmcli dev status
把結果直接 選取/複製/貼上來
192.168.24.0-192.168.24.200;
111.111.1.10-111.111.1.200;
111.111.2.10-111.111.2.200
这三个网段;
9. 能否補充一下 為何選擇這三個網段
如果有參考網路上的文章
請提供網址

Re: ubuntu如何设置多作用域

发表于 : 2016-11-21 17:57
lilycn
附上我的设置档案:求大神帮忙看哈,为什么后面两个的网段会分不到IP地址?
/etc/dhcp/dhcpd.conf
subnet 192.168.24.0 netmask 255.255.255.0 {
range 192.168.24.10 192.168.24.200;
option domain-name "example.com";
option routers 192.168.24.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.24.255;
option domain-name-servers 192.168.24.2;
option ntp-servers 192.168.24.1;
option netbios-name-servers 192.168.24.1;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
}
subnet 111.111.1.0 netmask 255.255.255.0 {
range 111.111.1.10 111.111.1.200;
option domain-name "example.com";
option routers 111.111.1.254;
option subnet-mask 255.255.255.0;
option broadcast-address 111.111.1.255;
option domain-name-servers 192.168.24.2;
option ntp-servers 111.111.1.254;
option netbios-name-servers 111.111.1.254;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
}
subnet 111.111.2.0 netmask 255.255.255.0 {
range 111.111.2.10 111.111.2.200;
option domain-name "example.com";
option routers 111.111.2.254;
option subnet-mask 255.255.255.0;
option broadcast-address 111.111.2.255;
option domain-name-servers 192.168.24.2;
option ntp-servers 111.111.2.254;
option netbios-name-servers 111.111.2.254;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
}

etc/network/interfaces.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.24.2
netmask 255.255.255.0
gateway 192.168.24.1
auto eth1
iface eth1 inet static
address 111.111.1.254
netmask 255.255.255.0
auto eth2
iface eth2 inet static
address 111.111.2.254
netmask 255.255.255.0

Re: ubuntu如何设置多作用域

发表于 : 2016-11-21 18:13
poloshiao
https://help.ubuntu.com/community/dhcp3 ... interfaces
dhcp3-server and multiple interfaces
multiple interfaces example
抱歉 補正

1. Ubuntu 11.10 以前 參閱
https://help.ubuntu.com/community/dhcp3 ... interfaces
dhcp3-server and multiple interfaces

2. Ubuntu 12.04 以後 參閱
https://help.ubuntu.com/community/isc-d ... interfaces
dhcp3-server and multiple interfaces

Re: ubuntu如何设置多作用域

发表于 : 2016-11-21 19:36
cao627
但是直接配置多个就会dhcp server启动不了
附上我的设置档案:求大神帮忙看哈,为什么后面两个的网段会分不到IP地址?

dhcp服务到底能启动吗?

有无客户机在111.111.2. 和111.111.1.网段?

Re: ubuntu如何设置多作用域

发表于 : 2016-11-22 10:04
lilycn
按照我贴的设置,我现在是可以分配到192.168.24.X网段的IP,现在想实现的是让server在收到discover包时,能够给路由器分配一个111.111.1.X网段的IP,但是现在的话,我不知道如何去实现,因为连接路由器之后,根本分配不到正确的IP.....,如何去设置啊?我在抓包的时候,发现server根本没回应啊。我在想是不是route设置有问题?

Re: ubuntu如何设置多作用域

发表于 : 2016-11-22 12:14
poloshiao
*-network:0
product: 82599ES 10-Gigabit SFI/SFP+ Network Connection [8086:10FB]
physical id: 0
*-network
product: Killer E2200 Gigabit Ethernet Controller [1969:E091]
physical id: 0
1. 兩個網卡 共用一個 physical id: 0 ?
意思是 作業系統 可能把它門兩個看成同一個網卡 ?
*-network UNCLAIMED
product: Intel Corporation [8086:15B8]
configuration: latency=0
2. 沒有合適 網卡驅動

3. 你共有幾張網卡
sudo route -nv
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth2
4. 這個 route 應該刪除
4-1. 刪除方法
使用
sudo route del
指令
4-2. 參見
http://manpages.ubuntu.com/manpages/xen ... ute.8.html
route - show / manipulate the IP routing table
del delete a route.
sudo route -nv
内核 IP 路由表
目标 网关 子网掩码 标志 跃点 引用 使用 接口
111.111.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
111.111.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.24.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
5. 這個 route table 並不正確 每個 interface 都少了另外一半
5-1. 例如 eth0 少了
0.0.0.0 192.168.24.1 0.0.0.0 UG 0 0 0 eth0

6. 查閱一下你的主板使用手冊
最多支援幾張網卡 ?

Re: ubuntu如何设置多作用域

发表于 : 2016-11-22 17:07
lilycn
sudo route -nv
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth2
这个是怎么才能删除?看了文档,没成功啊。不知道这个有什么用?
我这边有两张网卡,eth1&eth2是同一张,但是有两个不同的口,eth0是电脑自带的网卡。

Re: ubuntu如何设置多作用域

发表于 : 2016-11-22 17:58
poloshiao
sudo route -nv
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth2
这个是怎么才能删除?看了文档,没成功啊。不知道这个有什么用?
1. http://askubuntu.com/questions/660355/w ... ting-table
Why 169.254.0.0 appears by default in the routing table?

2. 删除 試試

代码: 全选

sudo route del -net 169.254.0.0 gw 0.0.0.0 netmask 255.255.0.0 eth2
我这边有两张网卡,eth1&eth2是同一张,但是有两个不同的口,
3. 意思是 同一張卡 有兩個 IP ? 請詳讀該網卡使用手冊
3-1. http://askubuntu.com/questions/313877/h ... interfaces
How do I add an additional IP address to /etc/network/interfaces?