Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
If no arguments are given, ifconfig displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given interface only; if a single -a argument is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface.
$ ifconfig <interface> up $ ifconfig <interface> down
route
https://linux.die.net/man/8/route
Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program.
When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.
https://superuser.com/a/580674
The Gateway column identifies the defined gateway for the specified network. An asterisk (*) appears in this column if no forwarding gateway is needed for the network.
$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.16.63.253 0.0.0.0 UG 0 0 0 eth0 172.16.0.0 * 255.255.192.0 U 0 0 0 eth0
$ host baidu.com baidu.com has address 220.181.38.148 baidu.com has address 39.156.69.79 baidu.com mail is handled by 15 mx.n.shifen.com. baidu.com mail is handled by 20 mx50.baidu.com. baidu.com mail is handled by 10 mx.maillb.baidu.com. baidu.com mail is handled by 20 jpmx.baidu.com. baidu.com mail is handled by 20 mx1.baidu.com.
$ ip route get 220.181.38.148 220.181.38.148 via 172.16.63.253 dev eth0 src 172.16.62.130 cache
$ ping -c1 220.181.38.148 PING 220.181.38.148 (220.181.38.148) 56(84) bytes of data. 64 bytes from 220.181.38.148: icmp_seq=1 ttl=49 time=36.6 ms
--- 220.181.38.148 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 36.620/36.620/36.620/0.000 ms
root@nenuoj$ iptables -L -v --line-numbers Chain INPUT (policy ACCEPT 290 packets, 18937 bytes) num pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 202 packets, 41678 bytes) num pkts bytes target prot opt in out source destination
torapture@rapture$ ping -c4 D.D.D.D PING D.D.D.D (D.D.D.D) 56(84) bytes of data. 64 bytes from D.D.D.D: icmp_seq=1 ttl=45 time=192 ms 64 bytes from D.D.D.D: icmp_seq=2 ttl=45 time=180 ms 64 bytes from D.D.D.D: icmp_seq=3 ttl=45 time=194 ms 64 bytes from D.D.D.D: icmp_seq=4 ttl=45 time=180 ms
--- D.D.D.D ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2998ms rtt min/avg/max/mdev = 180.029/186.853/194.475/6.724 ms
root@nenuoj$ iptables -L -v --line-numbers Chain INPUT (policy ACCEPT 54 packets, 3339 bytes) num pkts bytes target prot opt in out source destination 1 4 336 DROP all -- any any S.S.S.S anywhere
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 44 packets, 13276 bytes) num pkts bytes target prot opt in out source destination
torapture@rapture$ curl D.D.D.D curl: (7) Failed to connect to D.D.D.D port 80: Connection refused
root@nenuoj$ iptables -L -v --line-numbers Chain INPUT (policy ACCEPT 91 packets, 5449 bytes) num pkts bytes target prot opt in out source destination 1 1 60 REJECT tcp -- any any S.S.S.S anywhere tcp dpt:http reject-with icmp-port-unreachable
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 70 packets, 14548 bytes) num pkts bytes target prot opt in out source destination
ip
https://linux.die.net/man/8/ip
ip - show / manipulate routing, devices, policy routing and tunnels
address
1 2 3 4 5 6 7 8 9
root@nenuoj$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 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 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:16:3e:10:27:9e brd ff:ff:ff:ff:ff:ff inet 172.16.62.130/18 brd 172.16.63.255 scope global eth0 valid_lft forever preferred_lft forever
link
1 2 3
root@nenuoj$ ip link show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
route
1 2 3
root@nenuoj$ ip route default via 172.16.63.253 dev eth0 172.16.0.0/18 dev eth0 proto kernel scope link src 172.16.62.130