CentOS 6.5 Static IP settings (NAT and bridging are applicable)
For convenience, use Xshell. and set the IP to static. Because, in CentOS, if its IP is not statically set, then each boot, its IP is dynamic change, this will bring trouble to follow-up work. To do this, we need to set it as a static IP.
To add, the way to obtain an IP address is: Automatic DHCP, manual none, and static. There is a lease period automatically, and once the deadline is reached, it will be withdrawn. If it is static, it will be used forever.
The specific process is as follows
1, open the local download and install the Xshell remote control
2. Open the new Session properties interface
3, this step, define its own session name, corresponding to write their own IP address. Click "OK"
4. The session was established successfully, as shown in. Click "Connect"
5, SSH Security Warning interface, select "Accept and save"
6, SSH user name interface, enter the login user name. As an example, log on as the root user. and tick "Remember user name"
7, SSH user authentication interface, enter the root user's password, and tick "Remember Password", click "OK"
8. Use the Ifconfig command to view the native IP so that its IP is set to a static IP that will be fixed for future use
9, Vi/etc/sysconfig/network-scripts/ffcfg-eth0
Above, is the default.
10, Mac settings, that is, the hardware address. Here, it is generally not necessary to change because it is consistent.
Device=eth0
Hwaddr=00:0c:29:e5:89:f4
Type=ethernet
Uuid=091cebce-3c05-46ae-a9e3-e9a9decb10bf
Onboot=yes
Nm_controlled=yes
Bootproto=static
11. IPV4 Address Settings
Defroute=yes//ROUTE
Peerdns=yes//dns
Peerroutes=yes//routes
Ipv4_failure_fatal=yes//ipv4
Ipv6init=no//ipv6
Name= "System eth0"//Name
ipaddr=192.168.80.128//IP Address
12, Bcast set, broadcast address. The IP address 192.168.80.128 speculated about its broadcast address 192.168.80.255
bcast=192.168.80.255
13. Setting the gateway address and subnet mask in NAT mode
Bridge is to see the local, that is, our physical machine, because the bridge means that our virtual machines and physical machines are connected to the router
routers issue IP. While NAT is equivalent to our computer virtual out of a router to configure NAT between all virtual machines. are working on this virtual router.
So its gateway is the one we set up for the virtual machine network settings. And the Bridge is to look at the router from the local physical machine can see that 's it !
Attention! This is not the local default gateway, but VMnet8 is the gateway in NAT mode.
In bridge mode, this is the subnet mask and gateway on the ground. (Bridging mode, see below for details * * * * * * * * * * * *)
gateway=192.168.80.2//Gateway
netmask=255.255.255.0//Subnet mask
At this point, the static IP is configured to complete
14. Mapping of IP addresses to host names
Vi/etc/hosts
Add 192.168.80.128 djt002 After
Then, restart, you can.
15, check the IP again, whether it is a static IP.
Thus, when the power is turned on again, its IP remains 192.168.80.128. Description of our static IP successfully set up.
Note ************** Extended knowledge 1*******************
If the virtual machine is configured with a bridging mode, the previous Mac,ipv4 address, the broadcast address is still ifconfig out of the configuration.
1) hwaddr=00:0c:29:e5:89:f4
2) ipaddr=192.168.80.128
3) bcast=192.168.80.255
Then, the next gateway and subnet mask is from the local.
In the virtual machine is bridged mode, the gateway and subnet mask are from the local.
Use shortcut key: System Key +r, can open quickly, cmd come in.
Note ******** knowledge extension 2****************
What if, after the static configuration described above, this happens?
Clearly configured is good ah, static IP address is also configured, then, it can only indicate that the domain name is a problem.
1. Configure the DNS server
Vi/etc/resolv.conf
192.168.80.2 is the gateway
The above is the default.
2, after the addition of NameServer 8.8.8.8
114.114.114.114 is the DNS (domain name resolution System) of Qihoo 360.
8.8.8.8 is Google's DNS.
114.114.114.119 can intercept fishing and hanging horse websites
114.114.114.114 only provides DNS resolution, without any filtering.
Perhaps, add one still does not work, that add Ali's DND, generally OK. 223.5.5.5
CentOS 6.5 Static IP settings (NAT and bridging are applicable)