How to setup DNS servers on host, connected to 2 networks?

Please, excuse me for my terrible English.

My host has two NICs, first in a network, connected to Internet through gateway, and the second one in a local network, with its own DNS server.
When i try to resolve a name to ip, a query have been send to DNS server, which stay on first position in /etc/resolv.conf, and, if server don’t know this name, the answer is “unknown host”. So, if i set my gateway on the first position in /etc/resolv.conf, i can resolve names from internet, and can’t resolve names from local network.

Of course, i can setup on my host a DNS server, which will send queries to local server the same way as to gateway. But i’m looking for a most simple way.

Can somebody prompt me a way, how can i set up my SLES for query both DNS servers - gateway and local DNS server.

My settings:

eth0 - local network (195.0.0.0 mask 255.255.0.0)
eth1 - network with gateway (192.168.0.0 mask 255.255.255.0 gateway 192.168.0.1)

ifconfig -a:

eth0 Link encap:Ethernet HWaddr 00:1D:60:48:B5:7D
inet addr:195.0.4.70 Bcast:195.0.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:60ff:fe48:b57d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7338 errors:0 dropped:0 overruns:0 frame:0
TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:663630 (648.0 Kb) TX bytes:6444 (6.2 Kb)
Interrupt:217

eth1 Link encap:Ethernet HWaddr 00:04:76:13:8F:1A
inet addr:192.168.0.56 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::204:76ff:fe13:8f1a/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:33025 errors:0 dropped:0 overruns:1 frame:0
TX packets:4737 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7125584 (6.7 Mb) TX bytes:703638 (687.1 Kb)
Interrupt:225 Base address:0xc00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:10758 errors:0 dropped:0 overruns:0 frame:0
TX packets:10758 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2013080 (1.9 Mb) TX bytes:2013080 (1.9 Mb)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

/etc/resolv.conf
search kbsapr.ru
nameserver 192.168.0.1
nameserver 195.0.0.7
#kbsapr.ru - windows-domen in local network

eth0
/etc/sysconfig/network/ifcfg-eth-id-00:1d:60:48:b5:7d
BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='195.0.4.70'
MTU=''
NAME='ASUSTeK Marvell 88E8001 Gigabit Ethernet Controller (Asus)'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='rBUF.FjMv6GbsXF7'
USERCONTROL='yes'
_nm_name='bus-pci-0000:04:04.0'
IFPLUGD_PRIORITY='20'
PREFIXLEN=''
NETMASK='255.255.0.0'


eth1
/etc/sysconfig/network/ifcfg-eth-id-00:04:76:13:8f:1a
BOOTPROTO='dhcp'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME='3Com 3C905CX-TX/TX-M Fast Etherlink for PC Management NIC'
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='JNkJ.wQq3lwZp4Y5'
USERCONTROL='no'
_nm_name='bus-pci-0000:04:00.0'

I know one thing for sure: this can not be resolved by doing something to resolv.conf. In resolv.conf the second (and further) servers are only mentioned for the case the first does not answer. All servers mentioned there are supposed to give the same information.

IMHO you can not have two seperate DNS worlds on one system. Normally you use your local DNS server (which has the zone files for your subdomains) and it points to the ouside DNS server(s) for all other information. So when you ask for forums.opensuse.org, you go to your local DNS server, which will forward this question to the DNS server of your ISP (or another one on the Internet).

On Tue, 2009-07-07 at 14:26 +0000, SuseSearcher wrote:
> Please, excuse me for my terrible English.
>
> My host has two NICs, first in a network, connected to Internet through
> gateway, and the second one in a local network, with its own DNS
> server.
> When i try to resolve a name to ip, a query have been send to DNS
> server, which stay on first position in /etc/resolv.conf, and, if server
> don’t know this name, the answer is “unknown host”. So, if i set my
> gateway on the first position in /etc/resolv.conf, i can resolve names
> from internet, and can’t resolve names from local network.

So, you’re local DNS is just local entries (presumably non-recursive not
handling entries outside of zones defined there).

You could setup your own DNS server (as you said). It’s not hard.
Just setup a zone that forwards out your local DNS zone/server. The
rest will be handled as a simple caching DNS.

That should do it.

>
> Of course, i can setup on my host a DNS server, which will send queries
> to local server the same way as to gateway. But i’m looking for a most
> simple way.

That IS the simple way… and it really is simple.

>
> Can somebody prompt me a way, how can i set up my SLES for query both
> DNS servers - gateway and local DNS server.

SuseSearcher wrote:

> My host has two NICs, first in a network, connected to Internet through
> gateway, and the second one in a local network, with its own DNS
> server.
> When i try to resolve a name to ip, a query have been send to DNS
> server, which stay on first position in /etc/resolv.conf, and, if server
> don’t know this name, the answer is “unknown host”. So, if i set my
> gateway on the first position in /etc/resolv.conf, i can resolve names
> from internet, and can’t resolve names from local network.
>
> Of course, i can setup on my host a DNS server, which will send queries
> to local server the same way as to gateway. But i’m looking for a most
> simple way.
>
> Can somebody prompt me a way, how can i set up my SLES for query both
> DNS servers - gateway and local DNS server.

How about using “/etc/hosts” file?

You can define there a list of local ip/machine names, not suitable for dns
querying but at least useful for lan browsing.

Greetings,


Camaleón

Thanks 2 all. I just wanted to be sure, that there are no other ways to solve this problem.
BIND waits for me :slight_smile:

p.s. Local network is too large for describing in /etc/hosts