Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Oct 082012
 

Modern way to show current IP address(es) in Linux

Answer:

In the past we already showed that you can get the IP information using the command "ifconfig", actually the modern way to do the job is

# ip a

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
  ..

2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:26:5e:3e:42:d2 brd ff:ff:ff:ff:ff:ff
 ..
Jul 092012
 

How to show current routing table

Answer:

To show the current system's routing table, you can try:

# sudo netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         102.147.87.1    0.0.0.0         UG        0 0          0 eth0
0.0.0.0         102.147.45.1    0.0.0.0         UG        0 0          0 eth0
102.147.45.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
102.147.87.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
Jun 212012
 

Network sniffing with tcpflow

Answer:

Wireshark is the De facto standard in network sniffing, but most of the time you might just want to analyse the content passing through your web browser or web server, then it is easy with tcpflow

For example, to show your communication with google.com to console, you can use

sudo tcpflow -c -i en0 src or dst host www.google.com