Hardware Reference
In-Depth Information
In this example, we have established a fixed IP address of 192.168.0.177, along with
the appropriate settings for gateway, netmask, network, and broadcast address. If the
network is not your own, get a network administrator to help you with the correct values
to use.
There is one other file that needs to be checked and potentially edited:
$ cat /etc/resolv.conf
domain myfastisp.net
search myfastisp.net
nameserver 192.168.0.1
If you've booted up your Raspberry Pi previously while it was using DHCP (with
network cable plugged in), these values may already be suitably configured. Otherwise,
you'll need to edit them to get the name service to work. In this example, the Internet
Service Provider is myfastisp.net , and name service requests are forwarded through the
firewall router at 192.168.0.1.
Test Static IP Address
Once you have configured things, the simplest thing to do is to reboot your Raspberry
Pi to make the new settings take effect (use sudo /sbin/reboot or sudo /sbin/
shutdown -r now ).
Once you've rebooted and logged in, check your IP address:
$ ifconfig eth0
eth0 Link encap : Ethernet HWaddr b8:27:eb:2b:69:e9
inet addr:192.168.0.177 Bcast: 192.168.0.255 Mask: 255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1
RX packets: 1046 errors: 0 dropped : 3 overruns: 0 frame: 0
TX packets: 757 errors: 0 dropped: 0 over runs : 0 carrier: 0
collisions:0 txqueuelen :1000
RX bytes: 74312 (72.5 KiB) TX bytes: 86127 (84.1 KiB)
In the preceding example, the inet addr matches our configured static IP address.
Let's now check that the names are resolving. Normally, I would recommend nslookup or
dig for this, but neither comes preinstalled on Raspbian. So let's just use ping :
$ ping −c1 google.com
PING google.com (74.125.226.4) 56 (84) bytes of data.
64 bytes from yyz06s05−in−f4.1e100.net (74.125.226.4): . . .
−−− google.com ping statistics −−−
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 11.933/11.933/11.933/0.000 ms
$
 
Search WWH ::




Custom Search