LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Without NetworkManager, how to keep the DNS info for both NICs ? (https://www.linuxquestions.org/questions/linux-networking-3/without-networkmanager-how-to-keep-the-dns-info-for-both-nics-923490/)

5883 01-12-2012 04:15 PM

Without NetworkManager, how to keep the DNS info for both NICs ?
 
say i don't have NetworkManager in the embedded linux,
all i have is /etc/resolv.conf for DNS, if i understand this correctly.

Now i have 2 NICs may connect to 2 different networks,
can i save the DNS info separately ?

Many thanks !

T3RM1NVT0R 01-12-2012 04:46 PM

@ Reply
 
Hi 5883,

You can specify the DNS in your network interface configuration file. You can specify DNS using following param:

DNS1=xxx.xxx.xxx.xxx
DNS2=xxx.xxx.xxx.xxx

Just make sure PEERDNS is set to NO otherwise it will update resolv.conf file with this information.

5883 01-12-2012 05:53 PM

wow, do you have a sample link somewhere ?
i did google and didn't find any samples.
thanks !

Quote:

Originally Posted by T3RM1NVT0R (Post 4573121)
Hi 5883,

You can specify the DNS in your network interface configuration file. You can specify DNS using following param:

DNS1=xxx.xxx.xxx.xxx
DNS2=xxx.xxx.xxx.xxx

Just make sure PEERDNS is set to NO otherwise it will update resolv.conf file with this information.


T3RM1NVT0R 01-13-2012 12:27 AM

@ Reply
 
You're welcome!

Here is the sample link: http://www.mombu.com/gnu_linux/mandr...f-1508104.html

5883 01-13-2012 12:25 PM

well, not sure i get it right, this is ubuntu, kernel 2.6.32

===== my /etc/network/interfaces =====
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 4.5.182.182
netmask 255.255.252.0
gateway 4.50.183.254
dns-nameservers 4.2.8.9


After reboot, my /etc/resolv.comf is still
nameserver 10.38.78.5
nameserver 10.38.58.5
domain thiscompany.ad
search thiscompany.ad

i'm not seeing my 4.2.8.9, :(

T3RM1NVT0R 01-13-2012 12:32 PM

@ Reply
 
If you want the NIC files to update resolve.conf then put the following entry in NIC:

PEERDNS=yes
DNS1=xxx.xxx.xxx.xxx

and then it should update your resolv.conf file.

Make sure that you take a backup of the files before editing.

5883 01-13-2012 06:37 PM

T3,

what is "NIC files" ?
i'm using ubuntu, never seen things like "PEERDNS, DNS1=..."

thanks !

Quote:

Originally Posted by T3RM1NVT0R (Post 4573787)
If you want the NIC files to update resolve.conf then put the following entry in NIC:

PEERDNS=yes
DNS1=xxx.xxx.xxx.xxx

and then it should update your resolv.conf file.

Make sure that you take a backup of the files before editing.


T3RM1NVT0R 01-14-2012 06:29 AM

@ Reply
 
Alright so you are using Ubuntu. That clear up the things a bit. I have checked this on my Ubuntu 11.04 system and here is the location where you should look for:

Quote:

/etc/NetworkManager/system-connections
Under this you will find out the connection files for your Wired Connection as well as Wireless Connection. I am using wired connection so I have got a file with the name Wired Connection 1. When I did a cat on this file here is the output that I got:

Code:

[802-3-ethernet]
duplex=full
mac-address=xx:xx:xx:xx:xx:xx

[connection]
id=Wired connection 1
uuid=0acd594e-89a1-402a-9610-deecb10e766e
type=802-3-ethernet
timestamp=3548542633

[ipv6]
method=auto

[ipv4]
method=manual
dns=192.168.1.1;
addresses1=192.168.1.20;24;192.168.1.1;

I will explain the [ipv4] section as that is the section where you need to edit the stuff. method=manual it means I have statically setup my ip address. dns=192.168.1.1 is my dns server which this interface will going to use. addresses1=192.168.1.20 is the IP I have configured on this machine. 24 is the subnet mask in use. 192.168.1.1 is also acting as my default gateway.

Make sure you take backup of any configuration file before making any changes to it. It is good to be safe then sorry :-)

5883 01-14-2012 09:40 AM

T3, 1st of all thanks very much for spending time looking into this.

i looked at networkManager before, but there's 1 issue blocking me from using it.
For our app, we have to make network changes in the command line, meaning we have to manually
edit the "Auto eth0", "Auto eth1" files under the /etc/NetworkManager folder.

But if you do a fresh install of ubuntu, i don't see these files,
until i click the up/down arrow icon in the right corner of the desktop, that's to bring down/up the network.

So for me, since i cannot access the desktop, i need to manually generate the "Auto eth0".
Then i can edit the ip address etc.

But there's a "uuid" field, i did't know where to get it. So i stopped there.

Our app will be running in the embedded board, that's why i have to use command line.

Quote:

Originally Posted by T3RM1NVT0R (Post 4574278)
Alright so you are using Ubuntu. That clear up the things a bit. I have checked this on my Ubuntu 11.04 system and here is the location where you should look for:



Under this you will find out the connection files for your Wired Connection as well as Wireless Connection. I am using wired connection so I have got a file with the name Wired Connection 1. When I did a cat on this file here is the output that I got:

Code:

[802-3-ethernet]
duplex=full
mac-address=xx:xx:xx:xx:xx:xx

[connection]
id=Wired connection 1
uuid=0acd594e-89a1-402a-9610-deecb10e766e
type=802-3-ethernet
timestamp=3548542633

[ipv6]
method=auto

[ipv4]
method=manual
dns=192.168.1.1;
addresses1=192.168.1.20;24;192.168.1.1;

I will explain the [ipv4] section as that is the section where you need to edit the stuff. method=manual it means I have statically setup my ip address. dns=192.168.1.1 is my dns server which this interface will going to use. addresses1=192.168.1.20 is the IP I have configured on this machine. 24 is the subnet mask in use. 192.168.1.1 is also acting as my default gateway.

Make sure you take backup of any configuration file before making any changes to it. It is good to be safe then sorry :-)


T3RM1NVT0R 01-14-2012 10:03 AM

@ Reply
 
To get the UUID you need to find out the device file attached with your ethernet device. And then you can run the following command to get the UUID:

Code:

blkid <device_file>

5883 01-14-2012 10:50 AM

Excellent,thanks again ! :)

Quote:

Originally Posted by T3RM1NVT0R (Post 4574408)
To get the UUID you need to find out the device file attached with your ethernet device. And then you can run the following command to get the UUID:

Code:

blkid <device_file>


T3RM1NVT0R 01-14-2012 10:51 AM

@ Reply
 
You're welcome. Please mark the thread as solved.

Enjoy linux!!!


All times are GMT -5. The time now is 06:39 AM.