I
I
Igor Petrov2015-10-06 19:57:25
linux
Igor Petrov, 2015-10-06 19:57:25

How to make DNS work through eth0??

Good day, I ran into such a problem, in general there are 2 servers, they are interconnected by an ipip tunnel, here is the config
machine 1
ip tunnel add ipip0 mode ipip local xx.xx.xx.xx remote uu.uu.uu.uu ttl 64 dev eth0
ip addr add 192.168.168.2/30 dev ipip0
ifconfig ipip0 up
#route add default ipip0
# Handle return routes
ip rule add from 192.168.168.0/30 table lan
ip route add default via 192.168.168.1 table lan
Machine 2
ip tunnel add ipip0 mode ipip local yy.yy.yy.yy remote xx.xx.xx.xx ttl 255
ip addr add 192.168.168.1/30 dev ipip0
ifconfig ipip0 up
iptables -A POSTROUTING -t nat -p tcp -s 192.168.168.0/ 30 -j SNAT --to-source yy.yy.yy.yy
iptables -A POSTROUTING -t nat -p icmp -s 192.168.168.0/30 -j SNAT --to-source yy.yy.yy.yy
iptables -t nat -A PREROUTING -d yy.yy.yy.yy -j DNAT --to-destination 192.168.168.2
iptables -A FORWARD -p tcp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -d 192.168.168.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
The bottom line is, I want 1 machine to send requests through 2 machines so that all connections go through it, I do route add default ipip0 on 1 machine, everything seems to be fine, but DNS disappears .... that is, the names do not resolve ... how to make it so that DNS on 1 machine is processed through its eth0 and not through ipip0?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Petrov, 2015-10-07
@daniks

Solved the problem like this,
ip route add yy.yy.yy.yy via GATEWAY_IP dev eth0
ip route del default
ip route add default via 192.168.168.1 dev ipip0

L
lega, 2015-10-06
@lega

how to make it so that DNS on 1 machine is processed through its eth0 and not through ipip0?
It is necessary that there would be a route for dns in eth0.
What do you have in?:
$ cat /etc/resolv.conf
$ route -n

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question