Set a static ip address in the linux system and ping the machine

1. Enter in the terminal: vi /etc/sysconfig/network-scripts/ifcfg-eth0

2. Start editing, fill in the ip address, subnet mask, gateway, DNS, etc. Among them, the "information in the red box" is a must have



 

ONBOOT=yes //Auto start at boot

BOOTPROTO=static //Static IP

DNS1=8.8.8.8  //DNS

IPADDR=10.27.0.3 //IP address

NETMASK=255.255.0.0 //Subnet mask

GETWAY=10.27.0.1 //Gateway

 

Save and exit.

3. Restart the network service. service network restart or /etc/init.d/network restart

4. If the ping fails to connect to the machine.

Turn off the firewall service iptables stop

Click on Virtual Settings and change the network adapter to bridge mode. Then ping the machine. Is it connected.



 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326753963&siteId=291194637