Thursday, August 29, 2019

Linux Networking 網絡功能

> ifconfig
Bring network up
ifconfig <interface> up

Bring network up with specific IP
ifconfig eth0 172.16.25.125

Bring network up with all parameters
ifconfig eth0 172.16.25.125 netmask 255.255.255.224 broadcast 172.16.25.63

Bring network down
ifconfig <interface> down

Simulate network outrage for 500 ms

ifconfig eth0 down; usleep 500; ifconfig eth0 up 

> DNS
Check currently-using DNS server
cat /etc/resolv.conf

Make simple DNS request

host yahoo.com
dig yahoo.com
nslookup yahoo.com 

> IGMP Group + AWK
Complicated Log Simplification with AWK
cat /proc/net/igmp
awk -F' ' 'NF==5 {print "INT " $2} NF==4 {print "GP " $1}' /proc/net/igmp
#explanation: if row num of field = 5, show INT and the second variable

#explanation: if row num of field = 4, show GP and the first variable

 

No comments:

Post a Comment