1、网关主机设置
服务器上有两块网卡,eth0使用*.*.*.*IP地址连接Internet,eth1连接LAN,则其/etc/network/interfaces的设置如下:
auto loiface lo inet loopback
auto eth0
iface eth0 inet static address *.*.*.* netmask 255.255.255.0 gateway *.*.*.254
auto eth1
iface eth1 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
当然也可以使用ifconfig进行配置:
$ ifconfig eth0 *.*.*.* netmask 255.255.255.0 $ route add default gw *.*.*.254 $ ifconfig eth1 192.168.0.1 netmask 255.255.255.0dns在/etc/resolv.conf中设置,修改或添加nameserver字段:
nameserver 202.120.2.101
如果ip地址是与mac绑定的,还要修改mac地址:
$ ifconfig eth0 down $ ifconfig eth0 hw ether *:*:*:*:*:* $ ifconfig eth0 up