CentOS 静态NAT配置

1. CentOS 6 静态NAT配置

编辑 /etc/sysconfig/network-scripts/ifcfg-eth0

1
2
3
4
5
6
7
8
9
10
11
12
DEVICE=eth0
HWADDR=00:0C:29:81:E7:5B
TYPE=Ethernet
UUID=5e19ab91-63d8-4e04-86ef-2a702a6bd136
NM_CONTROLLED=yes
# 主要是以下部分
ONBOOT=yes # 开机激活网卡
BOOTPROTO=static # 静态IP
IPADDR=192.168.57.131 # 指定IP
NETMASK=255.255.255.0 # 指定子网掩码
GATEWAY=192.168.57.2 # 指定网关
DNS1=114.114.114.114 # 指定DNS

重启网络服务 service network restart

检验配置

1
2
3
4
ifconfig            # 查看网关
ping 192.168.57.2 # ping网关
ping 114.114.114.114
ping www.baidu.com

panchaoxin wechat
关注我的公众号
支持一下