Home  >  Article  >  Operation and Maintenance  >  An example of configuring a static IP address for linux to access the external network

An example of configuring a static IP address for linux to access the external network

PHP中文网
PHP中文网Original
2017-06-21 14:02:473782browse

1. Check the network

# ifconfig

It is found that the network has not been configured yet and ping fails

2. Modify the network card configuration file

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

Add the following configuration:

ONBOOT=yes

BOOTPROTO=static

IPADDR=IP address

NETMASK=255.255.255.0

GATEWAY=Gateway

DNS1=8.8.8.8

:wq Save and exit

3. Restart the network service

 #service network restart

4. Test and find that ping fails. . .

5. Okay, there is something wrong with the configuration. Shut down first

# poweroff

6. Configure the network card

Click on Network Adapter

7. Change network connection

Select Hardware-->Network Adapter--> Select Bridge Mode and check the box to copy the physical network connection Status --> OK

8. Start the virtual machine and test the network

 

Test passed~~~

The above is the detailed content of An example of configuring a static IP address for linux to access the external network. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn