2018年4月30日 星期一

Linux 網路卡問題排錯 - IP

在 Linux/Unix 底下有幾個關於 IP 配置指令 :

ifconfig - 一般用於配置 IP , Netmask
# ifconfig eth0 192.168.1.1/24
# ifconfig eth0
eth0: flags=4163  mtu 1500
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 00:50:b1:03:a1:00  txqueuelen 1000  (Ethernet)
        RX packets 321985  bytes 415032409 (395.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 185822  bytes 19749935 (18.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
route - 調整路由
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.254   0.0.0.0         UG    100    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
ip - 跟 ip 有關係的都可以透過此指令
# ip route show
default via 192.168.1.1 dev eth0  proto static  metric 100
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.1  metric 100
# ip neigh show
192.168.1.254 dev eth0 lladdr 00:50:b1:03:a1:01 REACHABLE
# ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:b1:03:a1:00 brd ff:ff:ff:ff:ff:ff
# ip rule show
0: from all lookup local
32766: from all lookup main
32767: from all lookup default

沒有留言:

張貼留言