Xshell connects to the linux virtual machine
Modify the / etc/sysconfig/network-scripts/ifcfg-eth0 file and connect with xshell
# # simplify the system source files after installation # #
DEVICE=eth0
HWADDR=00:0C:29:20:48:74
TYPE=Ethernet
UUID=d8aaed80-c43f-4636-8266-f1f9cc19e075
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=dhcp
# # examples of modified contents of general files # #
DEVICE=eth0
HWADDR=00:0C:29:20:48:74
TYPE=Ethernet
UUID=d8aaed80-c43f-4636-8266-f1f9cc19e075
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=status
IPADDR=192.168.8.20
NETMASK=255.255.255.0
GETWAY=192.168.8.1
DNS11=192.168.8.1
# # General instructions # #
TYPE=Ethernet # Network Card Type
DEVICE=eth0 # Nic interface name
Does ONBOOT=yes # automatically load when the system starts?
BOOTPROTO=static # enable address protocol-- static: static protocol-- bootp protocol-- dhcp protocol
IPADDR=192.168.1.11 # Network Card IP address
NETMASK=255.255.255.0 # Network Card Network address
GATEWAY=192.168.1.1 # Network Card Gateway address
DNS1=10.203.104.41 # Network Card DNS address
HWADDR=00:0C:29:13:5D:74 # Network Card device MAC address
BROADCAST=192.168.1.255 # Network Card broadcast address
# # more detailed instructions # #
Name of DEVICE= "eth2" network card
Whether the parameters of NM_CONTROLLED= "yes" network mamager can be hosted by NNetwork Manager.
HWADDR= MAC address
TYPE=Ethernet Typ
PREFIX=24 subnet mask 24 bits
DEFROUTE=yes is default route. Whether to set this eth as the default route.
ONBOOT=yes is set to yes, and the network connection is automatically enabled when the system is powered on.
IPADDR= IP address
BOOTPROTO=none is set to none to disable DHCP, set to static to enable static IP address, and set to dhcp to enable DHCP service
NETMASK=255.255.255.0 subnet mask
DNS1=8.8.8.8 's first dns server
BROADCAST broadcast
UUID unique ID
TYPE=Ethernet network type is: Ethernet
BRIDGE= sets bridge network card
GATEWAY= Settings Gateway
DNS2=8.8.4.4 # second dns server
IPV6INIT=no forbids IPV6
Whether USERCTL=no allows non-root users to control the device, set to no, and can only be changed by root users.
NAME= "System eth2" is the name of a network connection.
MASTER=bond1 specifies the name of the master
SLAVE specifies that the interface is a component of an interface.
NETWORK network address
ARPCHECK=yes detection
Whether PEERDNS allows the DNS obtained by DHCP to override the local DNS
Whether PEERROUTES obtains a routing table entry from the DHCP server that defines the information for the default gateway of the interface
Whether IPV6INIT enables the interface of IPv6.
IPV4_FAILURE_FATAL=yes disable the device if ipv4 configuration fails
IPV6_FAILURE_FATAL=yes disable the device if ipv6 configuration fails
Re-import the ifcfg-eth0 network profile
[root@localhost ~] # / etc/init.d/network reload
Shutting down interface eth0: [OK]
Shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing up interface eth0: [OK]
Nic interface shutdown and activation
[root@localhost ~] # ifdown eth0 # shut down the network
[root@localhost ~] # ifup eth0 # start the network
Network service startup and shutdown
Method 1:
[root@localhost ~] # service network stop # turn off the network service
[root@localhost ~] # service network start # start the network service
[root@localhost ~] # service network restart # restart the network service
Method 2:
[root@localhost ~] # / etc/init.d/network stop
[root@localhost ~] # / etc/init.d/network start
[root@localhost ~] # / etc/init.d/network restart
Network card status query
[root@localhost ~] # service network status
Configured devices:
Lo eth0
Currently active devices:
Lo eth0
Temporary configuration of network card information, no need to restart.
[root@localhost ~] # ifconfig eth0 10.1.1.10 netmask 255.0.0.0
View the interface information of the network card. All interfaces are listed by default.
[root@localhost ~] # ifconfig
Eth0 Link encap:Ethernet HWaddr 00:0C:29:13:5D:74
Inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
Inet6 addr: fe80::20c:29ff:fe13:5d74/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:413 errors:0 dropped:0 overruns:0 frame:0
TX packets:572 errors:0 dropped:0 overruns:0 carrier:0
Collisions:0 txqueuelen:1000
RX bytes:47701 (46.5 KiB) TX bytes:64842 (63.3 KiB)
Base address:0x2000 Memory:d8920000-d8940000
Lo Link encap:Local Loopback
Inet addr:127.0.0.1 Mask:255.0.0.0
Inet6 addr: 1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:407 errors:0 dropped:0 overruns:0 frame:0
TX packets:407 errors:0 dropped:0 overruns:0 carrier:0
Collisions:0 txqueuelen:0
RX bytes:70759 (69.1 KiB) TX bytes:70759 (69.1 KiB)
View current route and gateway information
[root@localhost ~] # netstat-r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 000 eth0
169.254.0.0 * 255.255.0.0 U 000 eth0
Default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
DNS:
Hostname: CentOS
Master DNS:202.106.46.151
Second DNS:202.106.0.20
The third DNS:8.8.8.8
Network configuration:
Eth0
Static ip:192.168.1.106
Subnet mask 255.255.255.0
Default gateway IP 192.168.1.1
DEVICE=eth0
IPADDR=192.168.1.106
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
ONBOOT=yes
BOOTPROTO=none
GATEWAY=192.168.1.1
TYPE=Ethernet
"/ etc/sysconfig/network-scripts/ifcfg-eth0" 11L, 187C