ifconfig檢視配置別名ip等
[root@oldboy ~]# ifconfig
eth0 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.110 bcast:192.168.1.255 mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe37:e5dd/64 scope:link
up broadcast running multicast mtu:1500 metric:1
rx packets:2386 errors:0 dropped:0 overruns:0 frame:0
tx packets:1465 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
rx bytes:210774 (205.8 kib) tx bytes:179501 (175.2 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:65536 metric:1
rx packets:16 errors:0 dropped:0 overruns:0 frame:0
tx packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
rx bytes:1280 (1.2 kib) tx bytes:1280 (1.2 kib)
指定檢視乙個裝置:
[root@oldboy ~]# ifconfig eth0
eth0 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.110 bcast:192.168.1.255 mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe37:e5dd/64 scope:link
up broadcast running multicast mtu:1500 metric:1
rx packets:2465 errors:0 dropped:0 overruns:0 frame:0
tx packets:1562 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
rx bytes:217862 (212.7 kib) tx bytes:192459 (187.9 kib)
eth0:0(0-254)簡稱別名ip,主機網絡卡重啟或者伺服器重啟都會失效
[root@oldboy ~]# ifconfig eth0:1 192.168.1.108/24
[root@oldboy ~]# ifconfig
eth0 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.110 bcast:192.168.1.255 mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe37:e5dd/64 scope:link
up broadcast running multicast mtu:1500 metric:1
rx packets:3380 errors:0 dropped:0 overruns:0 frame:0
tx packets:2216 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
rx bytes:299729 (292.7 kib) tx bytes:270469 (264.1 kib)
eth0:0 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.109 bcast:225.168.1.255 mask:255.255.255.0
up broadcast running multicast mtu:1500 metric:1
eth0:1 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.108 bcast:192.168.1.255 mask:255.255.255.0
up broadcast running multicast mtu:1500 metric:1
eth0:3 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.107 bcast:192.168.1.255 mask:255.255.255.0
up broadcast running multicast mtu:1500 metric:1
eth0:4 link encap:ethernet hwaddr 00:50:56:37:e5:dd
inet addr:192.168.1.106 bcast:192.168.1.255 mask:255.255.255.0
up broadcast running multicast mtu:1500 metric:1
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:48 errors:0 dropped:0 overruns:0 frame:0
tx packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
rx bytes:4136 (4.0 kib) tx bytes:4136 (4.0 kib)
可以停用配置:ifconfig eth1:0 down
ip的方式配多個ip,成為輔助ip
heartbeat 高可用早起用的別名ip,centos6下ha也是輔助ip。
keeplived高可用一直用輔助ip
輔助ip新增方法:
[root@oldboy ~]# ip addr add 192.168.1.103/24 dev eth0:10
[root@oldboy ~]# ip addr
1: lo: mtu 65536 qdisc noqueue state unknown
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0:
mtu 1500 qdisc pfifo_fast state up qlen 1000
link/ether 00:50:56:37:e5:dd brd ff:ff:ff:ff:ff:ff
inet 192.168.1.110/24 brd 192.168.1.255 scope global eth0
inet 192.168.1.109/24 brd 225.168.1.255 scope global secondary eth0:0
inet 192.168.1.108/24 brd 192.168.1.255 scope global secondary eth0:1
inet 192.168.1.107/24 brd 192.168.1.255 scope global secondary eth0:3
inet 192.168.1.106/24 brd 192.168.1.255 scope global secondary eth0:4
inet 192.168.1.103/24 scope global secondary eth0
inet6 fe80::250:56ff:fe37:e5dd/64 scope link
valid_lft forever preferred_lft forever
ip的方式未來趨勢
ip add是檢視
網絡卡重啟別名ip失效:攜程配置檔案(/etc/sysconfig/network-scripts/ifcfg-eth0:1))
網絡卡重啟後輔助ip也會失效
檢視網路狀態:
ifconfig
iproute -n
hostname(uname -n) 檢視主機名
netstat(established建立連線的狀態,數量即表示網路連線數)
lsof
sandshell
Linux 檢視網路資訊和網路監控命令。
該命令用於檢視機器掛載的網絡卡情況。可見機器有兩個網絡卡,乙個時eth0,另乙個是本地回環虛擬網絡卡。另外,iproute2軟體包含乙個強大的網路配置工具ip,它是公升級版的ifconfig命令,提供了更多的高階功能。ping命令是用於檢測網路故障的常用命令,可以用來測試一台主機到另外一台主機的網路...
centost檢視網路資訊 linux檢視網路流量
在linux下怎麼看網路流量?在windows下,我們可以很方便的通過360來檢視網路流量,知道哪個程序占用的網路頻寬比較多。那在linux下怎麼看流量呢,對於web伺服器來說這是很重要的。下面這邊部落格很仔細的介紹了linux下看流量的方法 我使用了其中一些,還找了網上其他一些資料,總結如下 1....
Linux檢視網路資訊ifconfig
無論是linux 自動安裝還是我們手工安裝,linux 都會向你詢問有關網路的問題並配置相關的軟體。這個用於配置網絡卡的基本命令就是ifconfig。在執行ifconfig 命令後,系統將在核心表中設定必要的引數,這樣linux 就知道如何與網路上的網 信。ifconfig 命令有以下兩種格式 if...