Difference between revisions of "Linux: IPRoute2"

From RHS Wiki
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 15:28, 10 January 2018

Create tunnels

Steps

  1. Create a logical tunnel device
    ip tunnel add tun0 mode ipip local [host's A public ip] remote [remote host's B public ip]
  2. Assign an IP address to the device
    ip address add [private ip address] dev tun0
  3. 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

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