Main uses:
1, view the network interface settings: IFCONFIG–A or Ifconfig network interface –a
2, network configuration Ifconfig network interface [Add/del] IP address netmask Subnet Mask example: Ifocnfig eth0 10.2.3.4 [netmask 255.255.255.0]
3, the network interface activation/shutdown format: Ifconfig network interface Up/down
Configuring DNS
Create/etc/resolv.conf file, write DNS server address inside
Configuring host Names
Configure the/etc/sysconfig/network file and use hostname to modify the host name
Use examples:
Copy Code code as follows:
[root@twin0898 sysconfig]# Cat Network
Network networking/network-scripts/
[root@twin0898 sysconfig]# Cat Network
Networking=yes
gateway=125.39.149.1
hostname=twin0898
Networking_ipv6=no
Common format:
1, to the network Gateway Route add/delete-net Target Network netmask mask GW gateway address [Dev network interface]
2, to a single host of the gateway Route Add/delete-host target host GW gateway address [Dev network interface]
3, add default gateway: Route add defaults GW gateway address Check Host routing table: ROUTE,NETSTAT-NR
Summarized as follows:
1. Network Configuration check: ifconfig-a
2, connectivity check: Ping, traceroute
3. routing table check: route or NETSTAT–NR
4. DNS Client run status check: nslookup
Examples of use are as follows
Ifconfig-a
Copy Code code as follows:
root@cinematest2:/usr/local/jdk# ifconfig-a
Eth0 Link encap:ethernet hwaddr b8:ac:6f:38:10:c6
inet addr:192.168.232.127 bcast:192.168.232.255 mask:255.255.255.0
Inet6 ADDR:FE80::BAAC:6FFF:FE38:10C6/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:42918159 errors:0 dropped:0 overruns:0 frame:0
TX packets:40893832 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30644395811 (30.6 GB) TX bytes:30932951131 (30.9 GB)
Interrupt:16
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:65536 metric:1
RX packets:917 errors:0 dropped:0 overruns:0 frame:0
TX packets:917 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:81417 (81.4 KB) TX bytes:81417 (81.4 KB)
Ping vip.jb51.net
Copy Code code as follows:
PING movie.kankan.co.sandai.net (114.80.189.60) bytes of data.
Bytes from 114.80.189.60:icmp_seq=1 ttl=54 time=31.2 ms
Bytes from 114.80.189.60:icmp_seq=2 ttl=54 time=29.9 ms
Bytes from 114.80.189.60:icmp_seq=3 ttl=54 time=31.1 ms
Bytes from 114.80.189.60:icmp_seq=4 ttl=54 time=30.5 ms
Bytes from 114.80.189.60:icmp_seq=5 ttl=54 time=31.4 ms
Bytes from 114.80.189.60:icmp_seq=6 ttl=54 time=32.6 ms
Bytes from 114.80.189.60:icmp_seq=7 ttl=54 time=30.8 ms
Bytes from 114.80.189.60:icmp_seq=8 ttl=54 time=30.9 ms
Bytes from 114.80.189.60:icmp_seq=9 ttl=54 time=32.0 ms
Bytes from 114.80.189.60:icmp_seq=10 ttl=54 time=31.3 ms
Bytes from 114.80.189.60:icmp_seq=11 ttl=54 time=31.3 ms
Bytes from 114.80.189.60:icmp_seq=12 ttl=54 time=30.3 ms
---movie.kankan.co.sandai.net ping statistics---
Packets transmitted, received, 0% packet loss, time 11004ms
RTT Min/avg/max/mdev = 29.954/31.148/32.608/0.704 ms
Netstat-nr
Copy Code code as follows:
root@cinematest2:/usr/local/jdk# NETSTAT-NR
Kernel IP Routing Table
Destination Gateway genmask Flags MSS Window Irtt iface
0.0.0.0 192.168.232.2 0.0.0.0 UG 0 0 0 eth0
192.168.232.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Nslookup vip.jb51.net
Copy Code code as follows:
Root@cinematest2:/etc# nslookup vip.jb51.net
server:192.168.8.150
address:192.168.8.150#53
Non-authoritative Answer:
Vip.jb51.net canonical name = Movie.jb51.net.
Movie.jb51.net canonical name = Movie.kankan.co.sandai.net.
Name:movie.kankan.co.sandai.net
address:114.80.189.60
Name:movie.kankan.co.sandai.net
address:119.147.41.209