Vyatta – My Basic Setup Guide
If you havenâ€™t already been introduced to Vyattaâ€¦ Vyatta meet reader, reader meet Vyatta.Vyatta is a fairly new Opensource, Debian based router thatâ€™s taking geeks by storm. And I can tell you from personal experience with Vyatta that itâ€™s a powerful system.
So, I would put together a quick start guide on getting Vyatta working â€œout of the box.â€ Here it isâ€¦
Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers
STEP 1: Installing and Updating Vyatta
Letâ€™s assume you have already downloaded the ISO Image from Vyattaâ€™s website and burned it to CD and you have the hardware there that you want to run Vyatta on. For my example, Iâ€™m running an AMD Sempron 2600, 1GB Ram, 80GB HD, 2 Ethernet Cards (min. suggestion for a good router.) Okay, pop the CD in the drive and boot up to the CD. It should start loading the OS and Vyatta.
Vyatta is setup so you donâ€™t have to have a hard drive to run it. It can run directly from the CD, as itâ€™s setup in a â€œlive cdâ€ format. Problem with this is, if you reboot, you lose your configuration settings. So weâ€™ll want to install it to the drive, in my case 80GB is major overkill. To do this, youâ€™ll first need to login to Vyatta once itâ€™s booted up. The default logins are (user: root pass: vyatta) To install to the drive you will issue the command:
During the install you will be asked how much diskspace to allot to the different partitions. I went with the default. Once thatâ€™s complete, pop the CD out, and reboot to your installed Vyatta. Now we can start configuring the system. Letâ€™s start by setting up the Debian repos and making sure weâ€™re running the latest version of Vyatta. So you need to get into the Vyatta configure Cli. You can go this by logging in as root and then running the commands:
su vyatta configure set system package repository community component "experimental testing main" set system package repository community url http://archive.vyatta.com/vyatta set system package repository etch component main set system package repository main url http://mirrors.kernel.org/debian commit exit exit
STEP 2: Configuring Ethernet Interfaces
I have some static IPs from my internet provider, so Iâ€™m going to assign one of them to one of the ethernet cards, and the other ethernet card will be used for my LAN. Below is sample code from my setup:
set interfaces ethernet eth0 address 126.96.36.199 prefix-length 29 set interfaces ethernet eth0 description "Internet" set interfaces ethernet eth1 address 192.168.15.1 prefix-length 24 set interfaces ethernet eth1 description "OfficeLan" commit
So I created my first interface with my ISPâ€™s IP: 188.8.131.52 /29 which is netmask: 255.255.255.248 (If you need to know how to get your prefix-length – good luck. Itâ€™s hard to explain without having some networking knowledge.) I also, added a description for this interface as â€œInternetâ€ as I tend to get forgetful. This ethernet card will be plugged into my internet connection.
The second interface I created with the LAN IP: 192.168.15.1 /24 which is netmask: 255.255.255.0, and gave it a description as â€œLan.â€ This ethernet will be plugged into a Switch or Hub which my workstations and IP phones are plugged into.
By the way, you may have noticed the â€œcommitâ€ command. This basically commits my settings to the system. If thereâ€™s something missing, or conflicting, it will let me know during the commit.
STEP 3: Setting Up Route and NAT
So the workstations and phones that will be connected to the same switch as my LAN ethernet, will have 192.168.15.x IPs, I want them to have an internet connection and the rest of the world to see their IP as: 184.108.40.206. I need to setup my route and NAT. Below Iâ€™m doing that.
set protocols static route 0.0.0.0/0 next-hop 220.127.116.11 set service nat rule 1 set service nat rule 1 type source set service nat rule 1 translation-type masquerade set service nat rule 1 outbound-interface eth0 set service nat rule 1 protocols all set service nat rule 1 source network 192.168.15.0/24 set service nat rule 1 destination network 0.0.0.0/0 commit
So in the above, I setup the route with the next-hop being my default gateway from my ISP: 18.104.22.168. This will give my LAN the internet connection. The rest translates my LAN IPs into the ISP IP.
STEP 4: Setting up DHCP Server
While having static LAN IPs set on all my workstations and Phones is best, I do have users that come and go on their laptop. So I want the router to automatically assign IPs. I can set that up below:
set service dhcp-server name OfficeLan start 192.168.15.2 stop 192.168.15.27 set service dhcp-server name OfficeLan network-mask 24 set service dhcp-server name OfficeLan dns-server 22.214.171.124 set service dhcp-server name OfficeLan dns-server 126.96.36.199 set service dhcp-server name OfficeLan default-router 192.168.15.1 set service dhcp-server name OfficeLan interface eth1 set service dhcp-server name OfficeLan domain-name officelan.hostname.com commit
In the example above, I want no more than 25 dynamic IPs on my network, so the DHCP server is only going to assign IPs in the range: 192.168.15.2 through 192.168.15.27. I setup the default nameservers to be Level3â€™s: 188.8.131.52 and 184.108.40.206 with the gateway: 192.168.15.1 on my second ethernet. And then I gave it a hostname.
Thatâ€™s all you need for a basic setup. Thereâ€™s additional configurations that can be done, including firewalls, etc. Hopefully I will publish something on those shortly.
Note: The above instructions work for the Vyatta Community Edition 2. Instructions for Vyatta community edition 3 (released on October 31, 2007) are a bit different from the above.
About the author:
Robert Broyles is Team Leader at the Bobcares Phone Support Center, Phoenix, AZ. While he is not busy managing the team and Phone support, Robert loves to tweak open source systems like Asterisk, Vyatta etc. His blog can be found at http://hostseries.com/