Linux network configuration

question:

Install a virtual machine in VMware, use the bridge mode link, and cannot connect to the Internet. The reason for the problem is that the newly installed system is not configured with a network card.

 

Solution:

1. Modify the network card configuration file: vi /etc/sysconfig/network-scripts/ifcfg-eth0

content:

 

DEVICE="eth0" #Network card device name, the default is OK

BOOTPROTO="static" #Network card to obtain IP method, the parameters are: static (static) | dhcp (dynamic) | none (no, will cause network restrictions) 

BROADCAST=192.168.1.255 #The broadcast address where the local area network is located (an address dedicated to sending to all workstations in the network at the same time )

ONBOOT="yes" #must be YES, the network card configuration is automatically loaded at startup

TYPE="Ethernet" #No need to add

GATEWAY=192.168.1.1 #Gateway address

NETMASK=255.255.255.0 #mask address

IPADDR=192.168.1.103 #If BOOTPROTO="static", it corresponds to the generated IP address

 

2. Set up DNS server

Edit, vim /etc/resolv.conf, content:

 

nameserver DNS1 #The main column is nameserver 192.168.1.1

nameserver DNS2 #次

 

3. Execute service network restart or /etc/init.d/network restart

 

etc/udev/rules.d/70-persistent-net.rules

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325342422&siteId=291194637