1、网关主机设置

eth0为外网网卡

(1) 修改/etc/network/interfaces文件内容如下:

auto lo eth0 eth1
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.123
netmask 255.255.255.0
gateway 192.168.1.1

当然也可以使用ifconfig进行配置:
$ ifconfig eth0 192.168.1.123 netmask 255.255.255.0
$ route add default gw 192.168.1.1

(2)修改DNS服务器配置文件: /etc/resolv.conf
//具体DNS地址依据ISP提供设置
nameserver 8.8.8.8
nameserver 8.8.4.4  //备用

修改完成后,/etc/init.d/networking restart重新启动。
 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐