1.使用ip addr 查看ip地址,检查ip是否生效,一安装好redhat7的时候,默认是没有配置ip地址的
[root@xc ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:99:33:ef brd ff:ff:ff:ff:ff:ff inet 192.168.100.199/24 brd 192.168.100.255 scope global eno16777736 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe99:33ef/64 scope link valid_lft forever preferred_lft forever
2.查看网络配置文件,根据相应的网络设置ip地址,子网掩码,网关
[root@xc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777736 HWADDR=00:0C:29:99:33:EF TYPE=Ethernet BOOTPROTO=static IPADDR=192.168.100.199 NETWORK=255.255.255.0 GATEWAY=192.168.100.254 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eno16777736 UUID=42a295fa-f7a0-4734-ae54-57cad8866303 ONBOOT=yes
3.重启网络
/etc/init.d/network restart service network restart
4.测试连通性
本文出自 “小城工作室” 博客,请务必保留此出处http://xcroom.blog.51cto.com/7941996/1758286
原文地址:http://xcroom.blog.51cto.com/7941996/1758286