vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:0B:E9:46
TYPE=Ethernet
UUID=290c1baf-9236-461a-86de-f702d94457f2
#开机启用
ONBOOT=yes
NM_CONTROLLED=yes
#静态IP
BOOTPROTO=static
#BROADCAST=192.168.134.255
#IP地址
IPADDR=192.168.134.150
#子网掩码
NETMASK=255.255.255.0
#NETWORK=192.168.134.0
#网关
GATEWAY=192.168.134.2
#配置DNS
DNS1=114.114.114.114
DNS2=10.203.104.41
centos 查看网关的命令
1.ifconfig -a 和 cat /etc/resolv.conf (主要查看ip/netmask和dns)
2.netstat -rn
3.cat /etc/sysconfig/network
4.cat /etc/sysconfig/network-scripts/ifcfg-eth0
5.traceroute 第一行就是自己的网关
6.ip route show
7.route -n