Difference between revisions of "Linux: IPRoute2"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) (Created page with "== Create tunnels == === Steps === # Create a logical tunnel device #:<pre> #::ip tunnel add tun0 mode ipip local [host's A public ip] remote [remote host's B public ip]</pre...") |
Rafahsolis (talk | contribs) |
||
| Line 14: | Line 14: | ||
<nowiki>ip tunnel add tun0 mode ipip local 105.105.105.105 remote 41.41.41.41 | <nowiki>ip tunnel add tun0 mode ipip local 105.105.105.105 remote 41.41.41.41 | ||
ip address add 192.168.12.2 dev tun0 | ip address add 192.168.12.2 dev tun0 | ||
| − | ip route add 10.0.10.0/24 via 192.168.12.2</nowiki> | + | ip route add 10.0.10.0/24 via 192.168.12.2 |
| + | ip route delete 192.168.1.0/24 dev eth0</nowiki> | ||
Latest revision as of 08:38, 23 February 2018
Create tunnels[edit]
Steps[edit]
- Create a logical tunnel device
- ip tunnel add tun0 mode ipip local [host's A public ip] remote [remote host's B public ip]
- Assign an IP address to the device
- ip address add [private ip address] dev tun0
- Set up routing rules to route traffic over the tunnel
- ip route add [remote network]/24 via [remote tunnels IP address]
- Each host is the mirror of the other when it comes to creating rules. E.G. The remote ip for host A is the local ip for host B and visa-versa.
Example[edit]
ip tunnel add tun0 mode ipip local 105.105.105.105 remote 41.41.41.41 ip address add 192.168.12.2 dev tun0 ip route add 10.0.10.0/24 via 192.168.12.2 ip route delete 192.168.1.0/24 dev eth0