1832651 Members
3012 Online
110043 Solutions
New Discussion

netmask

 
Sajjad Sahir
Honored Contributor

netmask


how i can find netmask address with the help of netstat command ? or any other command or file is there?
4 REPLIES 4
Kapil Jha
Honored Contributor

Re: netmask

hi you can use ifconfig command to find subnetmask
ifconfig
subnet would be in hex like ffffff00
so ff ff ff 00 qould be
255.255.255.0

BR,
Kapil
I am in this small bowl, I wane see the real world......
Ramesh S
Esteemed Contributor

Re: netmask

Hi

Also, you could have a look on /etc/rc.config.d/netconf file.

Thanks & Regards

Ramesh
Laurent Menase
Honored Contributor

Re: netmask

netstat -nrv?
127.0.0.1/255.255.255.255 127.0.0.1 UH 0 lo0 32808
12.12.12.12/255.255.255.255 12.12.12.12 UH 0 lan0 32808
192.168.0.24/255.255.255.255 192.168.0.24 UH 0 clic1 32808
192.168.1.24/255.255.255.255 192.168.1.24 UH 0 clic0 32808
192.168.1.0/255.255.255.0 192.168.1.24 U 2 clic0 31744
192.168.0.0/255.255.248.0 192.168.0.24 U 2 clic1 31744
12.0.0.0/255.0.0.0 12.12.12.12 U 2 lan0 1500
127.0.0.0/255.0.0.0 127.0.0.1 U 0 lo0 32808
default/0.0.0.0 12.12.16.1 UG 0 lan4 1500

Then lines where you see the netmasks are those where the gateway is your NIC addresses, but with only the flag U ( not UH)
Eric SAUBIGNAC
Honored Contributor

Re: netmask

Bonjour,

Probably a mix of some commands. For example :

netstat -in | egrep -v "^Name|^lo0" | while read LAN rab
do ifconfig $LAN | egrep inet | read rab IP rab NM rab
echo "$LAN : $IP / $NM"
done

will output :

lan1 : 192.168.111.177 / ffffff00
lan0 : 10.33.70.12 / ffff0000

Hope this will help

Regards

Eric