Linux NTP Server and Router

The below VM (Ubuntu 10.04.4) automatically logs in.

  • ip forwarding (routing) is enabled.

  • An NTP Server is installed and enabled.

  • eth1 is for a management connection. This can also connect to the internet for updates, packages, and to sync NTP.

  • eth2 onwards are for multiple ethernet connections.

  • eth4 is an example of multi-homing, that allows you to add as many extra subnets that you need.

To edit these configs, vi /etc/network/interfaces then reboot the vm ("reboot"). Note: Only the management interface going to the internet should have a gateway (usually set by DHCP). Each interface should go to one of the networks.

Rebooting takes around 10 seconds, it's a super slim down version of Linux.

How this VM was made

Auto Log in and sensible bash

See https://sites.google.com/site/anvilsoup/geek-stuff/linux-autocompletion for details.

Redo all interfaces

  1. mv/etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.bak

  2. reboot

  3. Update this file with the IP addresses for all interfaces of the router. Handy hint: In VirtualBox, for the MAC addresses, change the last digit to the interface number, and start from 1. This makes it easier to identify which MAC address corresponds to which interface inside the VM.

  4. vi /etc/network/interfaces

  5. Modify the interfaces to match. Note: Remove gateways on all the interfaces apart from the interface going to the internet. Each interface should go to one of the networks.

  6. reboot

Install NTP

  1. aptitude -y install ntp

  2. ntpq -p

Turn on IP routing

Edit /etc/sysctl.conf and search for the following lines:

# Uncomment the next line to enable packet forwarding for IPv4

net.ipv4.ip_forward=1