How do I bring my network up? I want to do some networking.
For reference on bringing your ZedBoard up check out my other post here: Zedboard! Bring
So you want to do some networking? Let's try and use the wget command to pull down the google homepage:
zynq> wget http://www.google.com
wget: bad address 'www.google.com'
Well that's not good ... Let's see if we can fix this.
View Settings
Ok, now that we have our board booted we can get into some cool Linux stuff. First things first, default settings. Here is our ifconfig output:
zynq> ifconfig
eth0 Link encap:Ethernet HWaddr 00:0A:35:00:01:22 inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:20 errors:0 dropped:0 overruns:0 frame:0 TX packets:20 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15720 (15.3 KiB) TX bytes:1409 (1.3 KiB) Interrupt:54 Base address:0xb000
And our route table output:
zynq> route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
Ok, so for some setups this might be just fine - specifically if you aren't going to be doing much (read: any) networking past a Zedboard <-> Laptop setup. In my case, I would like to get into some serious Linux based networking so I need a bit more control over how the board talks over Ethernet.
DNS Server Setup
First we need to learn about two files that the Linux networking sub-system uses to do it's job.
The first is resolv.conf. The resolv.conf file has a list of all the DNS servers Linux should use to do name look-up. That is, when you type in google.com, your system is going out and actually resolving that to an IP address, which it then connects to. You can not make connections to sites via their name, just their IP. But 207.217.77.82 is a lot harder to remember than a nice site name.
The resolv.conf lives in the /etc directory. So lets go there!
zynq> cd /etc
zynq> ls
dropbear init.d inittab.orig passwd
fstab inittab mtab profile
Well it looks like Digilent didn't include that file in their base Linux system, so we will have to create it!
zynq> cd /etczynq> touch resolv.confzynq> vi resolv.conf
Now, if you don't know how to use vi, it's okay. It is a very powerful editor but we are only going to use it for a little bit of text entry. First we need to enter edit mode by hitting the key. Now we can add text. We are going to add the following text:
nameserver 192.168.1.1
Once you do that hit the key and then +: (that's the shift key, plus the colon key). You will see a little colon shows up at the bottom left of the screen. We want to write the contents to the disk, and then exist so we are going to type in "qw!" (the ! point just does it rather than asking you if you are sure - I'm impatient ..). Your screen should look like this: