You are not logged in.

#1 2016-05-24 19:35:53

Izzette
Member
Registered: 2015-10-02
Posts: 25

NAT on virtual bridge interface [Solved]

I've been trying to set up NAT on a bridge interface on my computer to use with TAP/TUN and QEMU.  But, not only am I failing, but my attempt kills my connection to the internet.  This is what I've been doing is more or less this:

# echo 1 > /proc/sys/net/ipv4/ip_forwarding
# iptables -t nat -A POSTROUTING -o wlp1s0 -j MASQUERADE
# brctl addbr br0
# ip link set br0 up
# ip addr add dev br0 172.16.0.1/24
# ip route add default via 172.16.0.1 dev br0

If I follow this with

$ ping -4 google.com

it hangs for a long time on DNS resolution, then eventually gives

From deepthought (172.16.0.1) icmp_seq=1 Destination Host Unreachable

.
I can get my network to working again with

# ip link set br0 down

.
What am I doing terribly wrong?

Last edited by Izzette (2016-05-24 22:12:03)

Offline

#2 2016-05-24 22:11:39

Izzette
Member
Registered: 2015-10-02
Posts: 25

Re: NAT on virtual bridge interface [Solved]

Nevermind, I figured it out, 172.16.0.1 shouldn't been a default route on my router/VM-host.  I also added some new iptables rules, but I don't think they were absolutely necessary.

Offline

Board footer

Powered by FluxBB