You are not logged in.

#1 2016-12-30 21:48:24

bergoid
Member
Registered: 2016-12-30
Posts: 1

DNS problem with 2 network interfaces

Hi all,

I'm in the process of setting up an Arch Linux VM with Virtualbox on my company laptop (Windows) in order to have a sane development environment (essentially dwm + st + bash + tmux + vim + ssh).

So far everything goes well apart from a curious problem that popped up as soon as I tried to have 2 network interfaces.

My VM originally had 1 NAT network adapter that enabled internet access. I added a host-only adapter with a static IP address so that I could use my web browser on Windows to visit a server (lighttpd) running on my VM, as is explained on these two pages:

https://geert.vanderkelen.org/2011/virt … -internet/
http://askubuntu.com/questions/293816/i … ess-the-in

The problem is that DNS doesn't work anymore after every reboot:

$ curl www.google.com
curl: (6) Could not resolve host: www.google.com

When I disable the host-only adapter temporarily everything works fine from then on:

$ sudo ip link set enp0s8 down
$ sudo ip link set enp0s8 up
$ curl www.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.be/?gfe_rd=cr&amp;ei=uMJmWLGZHujG8Af-oq14">here</A>.
</BODY></HTML>

I could run a script at startup with the "down" and "up" commands to make sure DNS works but this feels like a workaround. Is there a more robust solution, like changing something in a config file?

FWIW, here is some extra info about my setup:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:59:f3:5e brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::c64b:fea4:36e4:5fea/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:0d:ee:85 brd ff:ff:ff:ff:ff:ff
    inet 192.168.236.10/24 brd 192.168.236.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe0d:ee85/64 scope link 
       valid_lft forever preferred_lft forever
$ ps -aux | grep dhcp
root       363  0.0  0.0   2676  2132 ?        Ss   20:03   0:00 /usr/bin/dhcpcd -q -w enp0s3
bergoid    918  0.0  0.0   4752  2328 pts/1    S+   21:52   0:00 grep dhcp
$ cat /etc/netctl/enp0s8
Description='static ip address'
Interface=enp0s8
Connection=ethernet
IP=static
Address=('192.168.236.10/24')
Gateway=('192.168.236.1')
$ cat /etc/dhcpcd.conf
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
noipv4ll

# Disable ARP probing
noarp

Offline

#2 2017-01-07 15:18:40

leonshaw
Member
Registered: 2012-01-11
Posts: 19

Re: DNS problem with 2 network interfaces

Could you try removing this line from netctl config:

Gateway=('192.168.236.1')

Offline

Board footer

Powered by FluxBB