Centos gateway Modification
Modify the gateway configuration file of the corresponding Nic
[[Email protected] # vi/etc/sysconfig/Network
Modify the following content
Networking = Yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot be started)
Hostname = centos (set the Host Name of the local machine. The host name set here must correspond to the host name set in/etc/hosts)
Gateway = 192.168.1.1 (set the IP address of the gateway connected to the local machine. For example, the gateway is 10.0.0.2)
3. Modify DNS in centos
Modify the DNS configuration file of the corresponding Nic
# Vi/etc/resolv. conf
Modify the following content
Nameserver 8.8.8.8 # Google Domain Name Server
Nameserver 8.8.4.4 # Google Domain Name Server
4. Restart Network Configuration
# Service network restart
Or
#/Etc/init. d/network restart
Modify IP Address
Effective immediately:
# Ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Start effective:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Modify gateway Default Gateway
Effective immediately:
# Route add default GW 192.168.0.1 Dev eth0
Start effective:
Modify/etc/sysconfig/Network
Modify DNS
Modify/etc/resolv. conf
The modification takes effect immediately and starts as well.
Modify host name
Effective immediately:
# Hostname centos1
Start effective:
Modify/etc/sysconfig/Network
It's not easy for centos to modify network settings. You can finally access the Internet in virtualbox.