linux modify ip address
The content of the picture is my computer, to be set according to your network
0. View network status
At the command line, type ifconfig (Windows is ipconfig), view the current network status (ip, mask, etc.)
1. Check the network gateway
At the command line, enter route -n , see your gateway and remember
2. Modify ip
Open with vim / etc / sysconfig / network-scripts / ifcfg-eth0 (eth0 is the name of the NIC, depending on what you configure a network card)
vim /etc/sysconfig/network-scripts/ifcfg-eth0
2.1 Set dynamic ip
BOOTPROTO = dhcp, the other can not fill, dns can write
2.2 set up a static ip
BOOTPROTO = static, other required
3. Restart network
At the command line, type Service Network restart , restart card services
4. Check dns
Open /etc/resolv.conf with vim, to see whether the change dns server
vim /etc/resolv.conf
4. Test Network
ping it, test the connection fails, or if dns can resolve the domain name ping www.baidu.com
or a ping ip address
5. Frequently Asked Questions: ping domain name appears unknown host domain name
ping ip is on but can not resolve domain name:
this is ifcfg-eth0 in dns did not write, or resolv.conf no change, no dns DNS server, resulting in domain name can not be resolved, to modify the ifcfg-eth0, then restart the network service .