Logo

Home Router Configure Networking

This video will look at how to configure the routing on Lubuntu to allow the operating system to work as a router. The video also looks at how to configure other network settings like the IP Address, DNS, gateway, etc.

Show lesson content
Demonstration configure routing
Linux systems by default do not allow routing between interfaces for security reasons. The configuration for different Linux systems may be in different locations depending on the distribution.

1. Edit the file /etc/sysctl.conf using your choice of editing software. In this case pico was used.

2. Two settings need to be enabled to allow routing for IPv4 and IPv6 packets. These are net.ipv4_ip_forward=1 and net.ipv6.conf.all.forwarding=1 These settings by default will have a hash at the start of the line which makes the line a comment and thus causes the line to be ignored.

Demonstration Network interfaces
Depending on the distribution of Linux, the configuration file may be in a different location. The file used in this demonstration can be download from http://ITFreeTraining.com/handouts/lab/interfaces or listed at the bottom of this description.

1. The file to configure the network interface is located in /etc/network/interfaces

2. Any line starting with a hash is ignored and is considered a comment. It is a good idea to add comments to the file to make it easier to read.

3. In order for an interface to be used, it needs to borrow up. This can be done with the auto command which is short for automatic. In order to bring up an interface, enter in auto followed by the identifier of the interface. Linux numbers its interfaces starting with eth0. When the computer starts up, Linux will bring its interface up automatically.

4. For IPv4 there are five lines. Unlike a lot of other configurations in Linux, the interface file allows additional details to be included on extra lines. So essentially the iface is the command and the rest of the information is the settings for that iface command. The commands are self-explanatory for the most part except for the first one. Iface standards for interface. After this is inet which is the networking family for IPv4. Static means the address is a configured address rather than a dynamic address obtained from a service like DHCP.

5. IPv6 is much the same as IPv4. The difference in the first iface line is that inet6 is used rather than inet. The address and netmask line are self-explanatory. Unlike IPv4 an additional line “pre-up modprobe ipv6” has been added. During the boot up sequence, if the IPv6 module has not been loaded the configuration of the IPv6 address will fail. Adding the pre-up command ensures that the module is always loaded before configuration. This likely could also be added in /etc/module. It is possible that IPv6 configuration will work without this line.

Interface file
# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback

#Network Interfaces

auto eth0

auto eth1

auto eth2

auto eth3

auto eth4

auto eth5

auto eth6

auto eth7

auto eth8

auto eth9

# eth0

iface eth0 inet static

address 192.168.0.250

netmask 255.255.255.0

gateway 192.168.0.1

dns-nameservers 192.168.0.1

iface eth0 inet6 static

pre-up modprobe ipv6

address fd::250

netmask 64

# eth1

iface eth1 inet static

address 192.168.2.1

netmask 255.255.255.0

iface eth1 inet6 static

pre-up modprobe ipv6

address fd:0:0:2::1

netmask 64

# eth2

iface eth2 inet static

address 192.168.5.1

netmask 255.255.255.0

iface eth2 inet6 static

pre-up modprobe ipv6

address fd:0:0:5::1

netmask 64

# eth3

iface eth3 inet static

address 192.168.10.1

netmask 255.255.255.0

iface eth3 inet6 static

pre-up modprobe ipv6

address fd:0:0:10::1

netmask 64

# eth4

iface eth4 inet static

address 192.168.200.1

netmask 255.255.255.0

iface eth4 inet6 static

pre-up modprobe ipv6

address fd:0:0:200::1

netmask 64

# eth5

iface eth5 inet static

address 192.168.12.1

netmask 255.255.255.0

iface eth5 inet6 static

pre-up modprobe ipv6

address fd:0:0:12::1

netmask 64

# eth6

iface eth6 inet static

address 192.168.3.1

netmask 255.255.255.0

iface eth6 inet6 static

pre-up modprobe ipv6

address fd:0:0:3::1

netmask 64

# eth7

iface eth7 inet static

address 192.168.6.1

netmask 255.255.255.0

iface eth7 inet6 static

pre-up modprobe ipv6

address fd:0:0:6::1

netmask 64

# eth8

iface eth8 inet static

address 192.168.11.1

netmask 255.255.255.0

iface eth8 inet6 static

pre-up modprobe ipv6

address fd:0:0:11::1

netmask 64

# eth9

iface eth9 inet static

address 192.168.4.1

netmask 255.255.255.0

iface eth9 inet6 static

pre-up modprobe ipv6

address fd:0:0:4::1

netmask 64

References
Download the interface files http://itfreetraining.com/handouts/lab/interfaces
Download the network map http://itfreetraining.com/handouts/lab/network-map.pdf

Credits

Lesson tags: lab
Back to: Lab > Home Router