Thursday, August 29, 2019

Linux Networking 網絡功能

> ifconfig
Bring network up
ifconfig <interface> up

Bring network up with specific IP
ifconfig eth0

Bring network up with all parameters
ifconfig eth0 netmask broadcast

Bring network down
ifconfig <interface> down

Simulate network outrage for 500 ms

ifconfig eth0 down; usleep 500; ifconfig eth0 up 

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

Make simple DNS request


> 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