查看Linux网络参数
- ifconfig—-查看网络接口
> [root@localhost ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:33:4A:0C
inet addr:192.168.4.115 Bcast:192.168.4.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe33:4a0c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8133 errors:0 dropped:0 overruns:0 frame:0
TX packets:5861 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:818322 (799.1 KiB) TX bytes:835205 (815.6 KiB)
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:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:946 (946.0 b) TX bytes:946 (946.0 b)
- hostname—-查看主机名
[root@localhost ~]# hostname
localhost
- route—-查看路由表
[root@localhost ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.4.0 * 255.255.255.0 U 1 0 0 eth1
default localhost 0.0.0.0 UG 0 0 0 eth1
- netstat—查看网络连接情况 -a 所有, -n 数字, -r路由表,-l监听,-t TCP, -u UDP, -p 进程号
[root@localhost ~]# netstat -antput
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:875 0.0.0.0:* LISTEN 2262/rpc.rquotad
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1963/rpcbind
tcp 0 0 0.0.0.0:33073 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:40337 0.0.0.0:* LISTEN 2266/rpc.mountd
tcp 0 0 0.0.0.0:53586 0.0.0.0:* LISTEN 2010/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2345/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2084/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2590/master
tcp 0 0 0.0.0.0:35161 0.0.0.0:* LISTEN 2266/rpc.mountd
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:42759 0.0.0.0:* LISTEN 2266/rpc.mountd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3041/mysqld
tcp 0 756 192.168.4.115:22 192.168.4.105:52347 ESTABLISHED 2788/sshd
tcp 0 0 :::111 :::* LISTEN 1963/rpcbind
tcp 0 0 :::53461 :::* LISTEN 2266/rpc.mountd
tcp 0 0 :::22 :::* LISTEN 2345/sshd
tcp 0 0 ::1:631