Overview
At times, you might need to know the IP addresses and the default gateways of all the existing NewNet servers. You can obtain these details from the servers by running specific commands.
This article provides the commands that should be run on every NewNet server to get its configuration.
Solution
IP Address
Use ifconfig
to display the details for all the interfaces currently available (even if they are down):
ifconfig -a
The output will be something similar to:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.20.30.91 netmask 255.255.255.0 broadcast 10.20.30.255 inet6 ff88::22cc:22ff:ff44:44aa prefixlen 64 scopeid 0x20<link> ether 00:01:02:03:04:aa txqueuelen 1000 (Ethernet) RX packets 1032431 bytes 67817254 (64.6 MiB) RX errors 0 dropped 653989 overruns 0 frame 0 TX packets 3970231 bytes 543593606 (518.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 305857749 bytes 31117842012 (28.9 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 305857749 bytes 31117842012 (28.9 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 |
Default Gateway
Use netstat
to display the kernel routing table:
netstat -nr
The output will be something similar to:
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.20.30.1 0.0.0.0 UG 0 0 0 eth0 10.20.30.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 100.200.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 |