Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I created two Virtualbox machines, both with Lubuntu Server 13.10. Server machine has Virtualbox NAT network and Internal network (static IP 192.168.1.1), Client machine has only Internal network adapter (static IP 192.168.1.2) and it's connecting to the Internet via Server machine (Server works as a gateway).

I assigned static local IP to both of them and created some IPtables rules. Everything is working except of one thing - Client cannot ping (or connect to) anyone (Server machine or the Internet) until Server computer sends him a ping (ping 192.168.1.2). After just a few ping packets, Client computer "unlocks" and everything is working fine.

Server ifconfig:

eth0      Link encap:Ethernet  HWaddr 08:00:27:20:03:00  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe20:300/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:260 errors:0 dropped:0 overruns:0 frame:0
          TX packets:310 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:32003 (32.0 KB)  TX bytes:32378 (32.3 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:fd:7d:aa  
          inet addr:192.168.1.1  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fefd:7daa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34 errors:0 dropped:0 overruns:0 frame:0
          TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:8537 (8.5 KB)  TX bytes:9206 (9.2 KB)

Server iptables:

iptables -F
iptables -F -t nat
iptables -X -t nat
iptables -F -t filter
iptables -X -t filter
iptables -P FORWARD ACCEPT
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth1 -j ACCEPT
iptables -A INPUT -i eth0 -s 10.0.2.15 -j DROP
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -i eth1 -o eth0 -s 192.168.1.0/255.255.255.0 -d 0/0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -d 0/0 -j MASQUERADE

Client ifconfig:

eth0      Link encap:Ethernet  HWaddr 08:00:27:2d:ec:78  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe2d:ec78/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:461 (461.0 B)  TX bytes:11601 (11.6 KB)

Client iptables:

iptables -F
iptables -F -t nat
iptables -X -t nat
iptables -F -t filter
iptables -X -t filter
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

I disabled ufw, but the problem persist. I also checked Virtualbox settings and they appear to be fine.

edit: I figured out what's wrong - after every reboot Client has wrong ARP table: Client and Server ARP tables and ifconfig How can I fix that? Sometimes arp -d 192.168.1.1 works, but usually I can't get rid of that strange MAC address...

I changed MAC address to one seen on a screen above. It didn't helped - after few restarts, MAC address switched again.

share|improve this question
add comment

1 Answer 1

I'm not a specialist, but I encountered a similar problem with VMWare. The ARP command on the client showed different MAC addresses, almost at random it would seem.

I solved it by disabling the VMNet virtual adapters of the VMnet I was using in the host operating system. The "strange" MAC addresss was the MAC address of that virtual adapter. I can now make my virtual clients connect immediately to the internet, through my virtual server.

Hope it helps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.