Thursday 4 December 2014

Configuration of Ethernet on Raspberry Pi

Step 1: Review current network settings(to see the prev net config)

From the command prompt or LXTerminal:
Type the command "ifconfig" this command will display the current network settings.

Step 2: Backup the current network configuration

It is a good idea to make a backup of the interfaces file if you are new to linux:
so type the following commands in the lx terminal

sudo cp /etc/network/interfaces /etc/network/interfaces.backup

Step 3: Modify the network settings

To edit the network setting you must edit the interfaces file.  The network can use a dynamic (DHCP) IP address or a static (set) IP address.  If you want to remotely login and control the Raspberry Pi, it is a good idea to use a static IP address.

The following command can be used to update the file in the linux terminal:

sudo nano /etc/network/interfaces

Look for the eth0 line which corresponds to the Raspberry pi ethernet (RJ45) port.
edit the file to look similar to this:
iface eth0 inet loopback                                    
iface eth0 inet static

change them as to the properties of the wifi or the lan cable  that are being used by the user for  example (by using the echo wl obtaining the ip of it and changes are made as follows)

iface eth0 inet loopback                                    
iface eth0 inet static
address 10.66.12.139- the last number is as you desired(IP address depends on network connected)
netmask 255.255.255.0
gateway 1o.66.12.254
Set the address to the IP address you want the Raspberry Pi to occupy.

Once the file has been updated, use ctrl x to save and exit

NOTE:No extra new lines or the space not to be added 

Step 4: Restart the Raspberry Pi
Once the interfaces files has been updated, you must restart the Raspberry Pi for the changes to take effect.

Used to following command to restart:

sudo shutdown -r now

Step 5: Test the new network setup

Use the "ping" command to confirm that the Raspberry Pi is on the network and talking to another computer also on the network.

If you have trouble pinging other computers on the network work, check the following:


1. Confirm that the ethernet cable is firmly connected to the Raspberry Pi and network switch.
2. Confirm that the IP address, mask and gateway are correct.
3. If pinging a Windows machine, sometimes security setting prevent responding to a ping request.

For this type ping 10.66.12.138    the IP should be similar to the IP of the raspberry pi given in the previous step.

0 comments:

Post a Comment