0

So i have a virtual machine in a private internal network on 192.168.200.0/24 with an ip address of 192.168.200.2.

The external network is 192.168.1.0/24. I would like to forward all traffic on an external ip to the vm on 192.168.200.2. This is what I have done...

First I add a secondary IP to an interface

ip addr add 192.168.1.111 dev eno1

Then I use these 2 iptables commands to setup the nat

iptables -t nat -A PREROUTING -d 192.168.1.111 -j DNAT --to-destination 192.168.200.2
iptables -t nat -A POSTROUTING -s 192.168.200.2 -j SNAT --to-source 192.168.1.111

This actually works. I can now ssh into 192.168.1.111 and i will be in the kvm instance with an ip of 192.168.200.2.

However, My problem is sometimes in ssh my entire connection just freezes. This happens all the time when I run commands like top or systemctl or man ip here is an example of top output right before it locks up my whole console

top - 19:45:58 up 2 days, 23:56,  3 users,  load average: 0.00, 0.00, 0.05
Tasks: 106 total,   1 running, 105 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3936.3 total,   2479.2 free,    150.1 used,   1307.0 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   3505.6 avail Mem

There is suppose to be way more output then just this ^^^ From here I can't ctrl C, ctrl Z, or q when I am in man. The problem goes away when I don't use 192.168.1.111 and use 192.168.200.2 to connect instead. I know for a fact its only when I use 192.168.1.111 to connect.

Could the problem be MTU fragmentation?

Any help would be appreciated.

EDIT: I just learned that anything over 1472 in ping -s 1472 192.168.1.111 gets dropped.

1 Answer 1

1

So my problem was entirely MTU. The host machine had an mtu of 1500 on the physical interface and an mtu of 1450 on the virtual device (This is for vxlan encapsulation). Along with this, the VM on the host machine had an mtu of 1500 which was causing the entire issue.

Change the mtu in linux

ip link set dev eth0 mtu 1500

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .