Link to home
Start Free TrialLog in
Avatar of Kocil
Kocil

asked on

View current nat connections

Dear experts.

This is on a Linux firewall, with iptables masquerading.
What is the command to view all active NAT connections ?

Thanks.

Avatar of Mercantilum
Mercantilum
Flag of Japan image


Using "netstat -a"  you can view active connections (not especially NAT).
But it may help.
Regards
Avatar of Kocil
Kocil

ASKER

I tried that
-----------------
root@firewall:~# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 *:swat                  *:*                     LISTEN      
tcp        0      0 *:time                  *:*                     LISTEN      
tcp        0      0 *:finger                *:*                     LISTEN      
tcp        0      0 *:auth                  *:*                     LISTEN      
tcp        0      0 *:ftp                   *:*                     LISTEN      
tcp        0      0 *:ssh                   *:*                     LISTEN      
udp        0      0 *:biff                  *:*                                
udp        0      0 *:ntalk                 *:*                                
udp        0      0 *:time                  *:*                                
raw        0      0 *:tcp                   *:*                     7          
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  3      [ ]         DGRAM                    152    /dev/log
unix  2      [ ]         DGRAM                    234    

-----------------

But I think that is not what I want.
I want to see NAT connections that are going THROUGH this firewall.

[clients (intranet)]-------------->[firewall (NAT)]--------------->[servers(intranet)]

So I know which client is connected to which server.

Thanks.


SOLUTION
Avatar of brabard
brabard

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
depends how you define "connection"
most reliable/complete would be brabard's suggestion
/proc/net/ip_conntrack just gives "established" connections, probably not enough for you ..
Avatar of Kocil

ASKER

Ok.
Answer from brabard and khkremercomplement each other.
I need both of them.

Thanks all.
use iptstate