- An Ansible meta-automation solution for automatically creating a home ubuntu server router.
- Last Updated: 2018-07-03
- First Started: 2018-07-02
- Ubuntu router will be flexible and secure.
- Developed for anyone who wants to have a home router solution solution.
- Install linux subsystem Windows 10
- a. Control Panel -> Programs -> Turn Windows Features on or off -> Windows Subsystem for Linux
- b. Go to microsoft store, seach Linux, and install Ubuntu
- Install ansible
- a. Go to command prompt, type bash
- b. sudo -s
- c. apt-get install software-properties-common
- d. sudo apt-add-repository ppa:ansible/ansible
- e. sudo apt-get update
- f. sudo apt-get install ansible
- Set up SSH keys
- a. On local host (machine you will use to ssh into the router) open bash in the command prompt and run these commands
- b. sudo -i
- c. ssh-keygen
- d. ssh-copy-id user@XXX.XXX.XXX.XXX (replace user with router username & replace XXX.XXX.XXX.XXX with your router's IP address)
- Edit the "hosts" file in the /etc/ansible directory
- a. add a line at the top of the following
- i. [router]
- ii. XXX.XXX.XXX.XXX ansible_user=user (replace user with router username & replace - XXX.XXX.XXX.XXX with your router's IP address)
- a. add a line at the top of the following
- Manually install python2.7 on the ubuntu server router: sudo apt-get install python
- Run the ansible script with: ansible-playbook main.yml --ask-become-pass
- Check for DHCP leases here: nano /var/lib/dhcp/dhcpd.leases
- Restart DHCP service with: sudo /etc/init.d/isc-dhcp-server restart
- Restart iptables: sudo systemctl restart netfilter-persistent
- Enable iptables: sudo systemctl restart netfilter-persistent
- Update iptables:sudo /etc/network/if-pre-up.d/iptables
- Restart DNS: sudo systemctl restart bind9
- Restart Networking: sudo systemctl restart networking.service
- Check Service Status (+ means service running, - means not running): sudo service --status-all
- Note: if interfaces won't start, it typically means /etc/iptables/rules.v4 has an error
- Note: /etc/iptables/rules.v4 is whitepsace sensitive. Each COMMIT lines must have not spaces before or after the work COMMIT and a blank line (with no spaces) above and below it. Also make sure that no line has extra whitepsace anywhere.
- Attempt to raise or lower interfaces: ifdown enp1s0, ifup enp1s0
- Note: I had a Motorola SBG6580 Surfboard Router/Modem. In order to switch it to Modem only mode, disable NAPT (requires a restart). If you need log back in use 192.168.100.1.