Contents
Check the Linux network environment.
●Use "ip -a" to check the network device.
[root@Lion ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 74:46:a0:fe:f9:5c brd ff:ff:ff:ff:ff:ff inet 192.168.11.62/24 brd 192.168.11.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::7646:a0ff:fefe:f95c/64 scope link valid_lft forever preferred_lft forever 3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 74:46:a0:fe:f9:5d brd ff:ff:ff:ff:ff:ff |
Check "eth0" above.
In order to check the Linux network environment, check the following five points.
1.Configure the network card
[root@Lion ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eth0 UUID=3c4021ab-eec3-4706-9667-99f9d893f34c DEVICE=eth0 ONBOOT=yes IPADDR=192.168.11.62 PREFIX=24 GATEWAY=192.168.11.1 DNS1=192.168.11.1 |
DEVICE=eth0 #Device name BOOTPROTO=static #Manual configuration or dhcp? BROADCAST=192.168.1.255 #Broadcast address IPADDR=192.168.1.38 #IP address of the device NETMASK=255.255.255.0 #Mask Value NETWORK=192.168.1.0 #network address HWADDR=00:14:2A:41:F9:1F #MAC address ONBOOT=yes #IF setting is done automatically at startup. |
2.DNS Settings
[root@Lion ~]# cat /etc/resolv.conf # Generated by NetworkManager nameserver 192.168.11.1 |
3.Setting the host name
[root@Lion ~]# cat /etc/hostname Lion |
4.Gateway Settings
[root@Lion ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 YPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eth0 UUID=3c4021ab-eec3-4706-9667-99f9d893f34c DEVICE=eth0 ONBOOT=yes IPADDR=192.168.11.62 PREFIX=24 GATEWAY=192.168.11.1 DNS1=192.168.11.1 |
5.Display the routing table
[root@Lion ~]# netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default buffalo.setup 0.0.0.0 UG 0 0 0 eth0 192.168.11.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 |
6.Ping the router to confirm communication
[root@Lion ~]# ping -c 4 192.168.11.1 PING 192.168.11.1 (192.168.11.1) 56(84) bytes of data. 64 bytes from 192.168.11.1: icmp_seq=1 ttl=64 time=0.321 ms 64 bytes from 192.168.11.1: icmp_seq=2 ttl=64 time=0.290 ms 64 bytes from 192.168.11.1: icmp_seq=3 ttl=64 time=0.318 ms 64 bytes from 192.168.11.1: icmp_seq=4 ttl=64 time=0.294 ms--- 192.168.11.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3000ms rtt min/avg/max/mdev = 0.290/0.305/0.321/0.025 ms |