安装vconfig命令,apt-get install vlan
service NetworkManager restart (如果没有网络报错,不必执行此命令)
vconfig add eth1 35 // eth1为物理网络接口名称,35为 802.1q tag id 也即 vlan ID
ifconfig eth1.35 192.168.128.1 // 对上步增加的子接口eth1.35 添加IP地址
ifconfig // 察看此子接口是否成功配置
==================================================
DHCP Server:
1. sudo apt-get install isc-dhcp-server
2. vi /etc/default/isc-dhcp-server
INTERFACES="eth1.35"
3.vi /etc/dhcp/dhcpd.conf 加入
subnet 192.168.128.0 netmask 255.255.255.0 {
range 192.168.128.30 192.168.128.40;
option broadcast-address 192.168.128.255;
option routers 192.168.128.1;
default-lease-time 6000;
max-lease-time 8000000;
}
sudo /etc/init.d/isc-dhcp-server start
/usr/sbin/dhcpd
service dhcpd start
service isc-dhcp-server restart
/etc/rc.d/init.d/dhcpd start
ps -aux | grep dhcpd // 察看dhcpd进程是否成功开启
阅读(7051) | 评论(0) | 转发(1) |