Link to home
Start Free TrialLog in
Avatar of jkockler
jkocklerFlag for United States of America

asked on

Linux Ubuntu command to show all nic card info

Running Linux Ubuntu

I am looking for the linux command to show all current nic information, including the DNS servers it is using, and the gateway.  

I am trying ifconfig with switches -a , -v, and -s, but I am not getting the DNS or gateway info.

- I am also having an issue where I am able to set the auto eth0 manually in the Ubuntu "network connections" and it holds the settings for awhile, but then I will check on it in a few days and it goes back to automatic settings.... Why is it setting back to automatic?  It could be happening after reboots but it should hold either way, right?
SOLUTION
Avatar of technious
technious

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
Avatar of technious
technious

As far as the problem with your IP settings changing get WICD.

Install in by opening a terminal and typing:
sudo apt-get install wicd

WICD allows you to have more than one IP profile for a wired NIC and you can set one to be your default, all with the GUI.
Avatar of jkockler

ASKER

Thanks technious.

Will WICD allow me to have 2 active IP addresses on 1 nic?  I want the nic card to be bound to 2 different ip addresses, using 2 different gateways.  Is this possible?
to see all your nics
ip a l
ifconfig -a

to see ethernet information
ethtool eth0

to view the hardware itself
lspci

to see gateway
netstat -r
or
route

you can add another ip addreess using ifconfig eth0 add 192.1687.0.1
to route both of them involve configuring the switch.
None of those commands are showing me the DNS informatin.  Technious, all of your commands failed completely.
Essentially, I am looking for the Linux equivalent to the Windows command:    ipconfig /all
Hope this helps someone out there.

Just open your choice of text editor, copy/paste the text below and don't forget to give it an ".sh" extension when naming the file. For example, just for kicks and giggles I named mine "ipconfig.sh".

Code:

#! /bin/bash
ifconfig
echo
echo Gateway"               "Interface
route -n | awk '/UG/ {printf "%-21s %s\n",$2,$8}'
echo
echo DNS Servers
awk '/nameserver/ {print $2}' /etc/resolv.conf
echo

After you've created the script, navigate to the folder the script is located in and run:

Code:

sudo chmod +x scriptname.sh

That makes the script executable from the CLI. After that I copied the script into the /usr/local/bin folder. That way you're able to simply run the script from the CLI without having to reference the folder the script was originally located in.

What's really neat is that when I connect to work via an IPSEC VPN, the script catches all of the new settings and gives both gateways in use. Wasn't expecting that without some extra work, but what do I know?
As far as I am aware, WICD only allows a single IP per interface. Just out of curiosity why in the world would you want two IP addresses on one NIC? Isnt that what VLANS are for?
Maybe a VLAN would work better in this situation, I do not know.

The reason is, I have 1 asterisk server that is going to be using 2 different internet connections, which are coming in on 2 different gateways, to 2 different firewalls.  The firewalls will then be connected to 1 switch, which asterisk is also connected to.  Since this will all be on the same subnet, I need 2 different private IP addresses on the asterisk nic, because there will be 2 different gateway addresses to send data back to the WAN through.

So and example of the set up is:

IP phone 1 >>>>>ISP Gateway 1 - WAN IP address 75.xx.xx.101>>>Firewall 1 - LAN Address 192.168.11.2 >>>> forward sip packets through port 5060 >> Switch >> to Asterisk server NIC IP 192.168.11.4 >>>>>>> Asterisk NIC sends data to gateway Firewall 1 (LAN Address 192.168.11.2)

IP Phone 2 >>>>>ISP Gateway 2 - WAN IP address 75.xx.xx.111 >>>>> Firewall 2 - LAN Address 192.168.11.3>>>>>>forward sip packets through port 5060 >> Switch >> to asterisk server NIC IP 192.168.11.5 >>> Asterisk NIC sends data to gateway Firewall 2 (LAN address 192.168.11.3)

So the real reason is because of 2 different LAN gateway addresses.

You may ask, why not just use a dual WAN firewall?.  The reason is, for the price range I am in for firewalls, 2 separate firewalls with a throughput of 90 MBPS, is going to be more cost effective than a Dual WAN firewall, that is able to supply 90 MBPS throughput for each port.

And of course, I have also considered just putting a second NIC card in the asterisk server, but I figured I would see how this would work first.

Could you see a VLAN solution that would work better here?

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