1. First of all, I am configuring the Internet under a virtual machine:
In the VMware network card settings, the configuration is as follows:
After entering the system, the default IP address is a very strange ip:192.168.48.1
Now start our work:
1.[root@localhost/]#cd/etc/sysconfig/network-scripts/
2.[root@localhost network-scripts]#ls
Ifcfg-eth0Ifdown-ipv6 ifup ifup-ipx Ifup-sit
Ifcfg-lo ifdown-isdn ifup-aliases ifup-isdn Ifup-tunnel
Ifdown ifdown-post IFUP-BNEP Ifup-plip ifup-wireless
IFDOWN-BNEP ifdown-ppp Ifup-eth Ifup-plusb Init.ipv6-global
Ifdown-eth ifdown-routes ifup-ippp ifup-post net.hotplug
IFDOWN-IPPP ifdown-sit ifup-ipsec ifup-ppp network-functions
Ifdown-ipsec Ifdown-tunnel Ifup-ipv6 ifup-routes Network-functions-ipv6
3.[root@localhost network-scripts]#gedit Ifcfg-eth0
4. Enter some configuration information, my configuration file is as follows:
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
device=eth0 hwaddr=00:0c:29:67:a2:13 ipaddr=
192.168.1.157
netmask=255.255.255.0
gateway=192.168.1.1
dns=192.168.1.1
bootproto=static
Onboot=yes
type=ethernet
prefix=24
defroute=yes
ipv4_failure_fatal=yes
ipv6init=no
name= "System eth0"
Uuid=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
Basically all see understand it, do not understand the words to find their own understanding it.
5.[root@localhost network-scripts]# /etc/init.d/network Restart
The basic step is some of the above, in fact, I have encountered a lot of problems in the configuration, the following one by one, if you also encountered, I hope you can refer to my solution.
1. First of all, I was in IFCONIFG, incredibly appear in front of my eyes is Eth4, not eth0, and in the system/etc/sysconfig/network-scripts/directory is incredibly ifcfg-eth0, then I was dumbfounded.
Solution:
A. Rm/etc/udev/rules.d/70-persistent-net.rules (Before you delete, you had better be able to back up, I am bold, what dare to do ...)
B. Reboot
C. After the reboot, Cat/etc/udev/rules.d/70-persistent-net.rules
Check the system automatically detected the network card related information, my information is as follows:
# This file is automatically generated by The/lib/udev/write_net_rules
# and run by the Persistent-net-generato R.rules rules file.
# You
can modify it, as long as your keep each rule in a single
# line, and change only the value of the Name= ke Y.
# PCI Device 0x1022:0x2000 (vmxnet)
subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c:29:67: A2:13 ", attr{dev_id}==" 0x0 ", attr{type}==" 1 ", kernel==" eth* ", name=" eth0 "
where "00:0c:29:67:a2:13" is the specific information we want to get,==>> MAC address.
D.cd/etc/sysconfig/network-scripts/
E.gedit Ifcfg-eth0
F. Modify the "hwaddr" parameter to: 00:0c:29:67:a2:13
G. /etc/init.d/network Restart
H. Ping Test:
[root@localhost/]# ping www.baidu.com
ping www.a.shifen.com (115.239.210.27) bytes of data.
Bytes from 115.239.210.27:icmp_seq=2 ttl=55 time=48.0 ms bytes from
115.239.210.27:icmp_seq=3 ttl=55 Ms
bytes from 115.239.210.27:icmp_seq=4 ttl=55 time=52.8 ms-
bytes from 115.239.210.27:icmp_seq=5 ttl=55 t ime=48.4 ms
bytes from 115.239.210.27:icmp_seq=6 ttl=55 time=48.1 MS, the bytes from
115.239.210.27:icmp_seq=7 ttl=55 time=48.8 ms
^c
---www.a.shifen.com ping statistics---
7 packets transmitted, 6 received, 14% packet Loss, time 6682ms
RTT Min/avg/max/mdev = 48.073/49.296/52.858/1.676 ms
[Root@localhost/]#