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?
LVL 4
jkocklerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

techniousCommented:
It is quite simple. Open a terminal and then:

To display the current configuration simply do the following:
 
sudo cat /etc/network/interface
 
To display the current DNS servers:
 
sudo cat /etc/resolv.conf

Open in new window

0
techniousCommented:
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.
0
jkocklerAuthor Commented:
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?
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

0renCommented:
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

0
0renCommented:
you can add another ip addreess using ifconfig eth0 add 192.1687.0.1
to route both of them involve configuring the switch.
0
jkocklerAuthor Commented:
None of those commands are showing me the DNS informatin.  Technious, all of your commands failed completely.
0
jkocklerAuthor Commented:
Essentially, I am looking for the Linux equivalent to the Windows command:    ipconfig /all
0
techniousCommented:
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?
0
techniousCommented:
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?
0
jkocklerAuthor Commented:
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?

0
0renCommented:
ipconfig /all
is like

ifconfig -a
route -n
cat /etc/resolv.conf
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.