User Tools

Site Tools


docs:guide-user:network:routing_in_gre

Example of routing with GRE

For creating a basic network configuration in GRE (Generic Routing Encapsulation) like it shows in the picture.

In this example, we will use 3 routers and 2 stations (computers).

R1

The following configuration is for the Router “R1” which is located in the directory /etc/config/network

config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'lan' option ifname 'eth1' # option type 'bridge' option proto 'static' option ipaddr '172.16.1.1' option netmask '255.255.255.0' option ip6assign '60' config interface 'lan2' option ifname 'eth0' option proto 'static' option ipaddr '10.1.1.1' option netmask '255.255.255.252' config interface 'wan' option ifname 'eth1' option proto 'dhcp' config interface 'wan6' option ifname 'eth1' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fd58:c7b9:863f::/48' config route 'default' option interface 'lan2' option target '0.0.0.0' option netmask '0.0.0.0' option gateway '10.1.1.2' config interface 'mygre' option ipaddr '10.1.1.1' option peeraddr '10.2.2.1' option proto 'gre' config interface 'mygre_static' option proto 'static' option ifname '@mygre' option ipaddr '172.16.12.1' option netmask '255.255.255.252' config route tunnel option interface 'mygre_static' option target '172.16.2.0' option netmask '255.255.255.0' option gateway '172.16.12.2'

WAN

For the “WAN” router which is located is also placed the directory /etc/config/network

config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'lan' option ifname 'eth0' # option type 'bridge' option proto 'static' option ipaddr '10.1.1.2' option netmask '255.255.255.252' option ip6assign '60' config interface 'lan2' option ifname 'eth1' option proto 'static' option ipaddr '10.2.2.2' option netmask '255.255.255.252' config interface 'wan' option ifname 'eth1' option proto 'dhcp' config interface 'wan6' option ifname 'eth1' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fd58:c7b9:863f::/48' config route 'network' option interface 'lan' option target '172.16.1.0' option netmask '255.255.255.0' option gateway '10.1.1.1' config route 'network2' option interface 'lan2' option target '172.16.2.0' option netmask '255.255.255.0' option gateway '10.2.2.1'

R2

Finally for the “R2” router which is located is also placed the directory /etc/config/network:

config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'lan' option ifname 'eth1' # option type 'bridge' option proto 'static' option ipaddr '10.2.2.1' option netmask '255.255.255.252' option ip6assign '60' config interface 'lan2' option ifname 'eth0' option proto 'static' option ipaddr '172.16.2.1' option netmask '255.255.255.0' config interface 'wan' option ifname 'eth1' option proto 'dhcp' config interface 'wan6' option ifname 'eth1' option proto 'dhcpv6' config globals 'globals' option ula_prefix 'fd58:c7b9:863f::/48' config route 'default' option interface 'lan' option target '0.0.0.0' option netmask '0.0.0.0' option gateway '10.2.2.2' config interface 'mygre' option ipaddr '10.2.2.1' option peeraddr '10.1.1.1' option proto 'gre' config interface 'mygre_static' option proto 'static' option ifname '@mygre' option ipaddr '172.16.12.2' option netmask '255.255.255.252' config route tunnel option interface 'mygre_static' option target '172.16.1.0' option netmask '255.255.255.0' option gateway '172.16.12.1'

PC configuration

For the pc configuration, we just set up the IP addresses in each station.

PC1 IP 172.16.1.3 netmask 255.255.255.0 gateway 172.16.1.1
PC2 ip 172.16.2.3 netmask 255.255.255.0 gateway 172.16.2.1

For the complete running functionality in GRE is necessary to install GRE in all routers. These packets are ”kmod-gre” and ”gre”

Installing the GRE packages

opkg install kmod-gre opkg install gre
docs/guide-user/network/routing_in_gre.txt · Last modified: 2018/08/31 20:32 by tmomas