configure network settings on raspberry pi hardware

Upload: lovelyosmile253

Post on 12-Oct-2015

27 views

Category:

Documents


0 download

DESCRIPTION

RPi

TRANSCRIPT

This is caused by you not having the Permissions to get softw are lock on dpkg. Thus, you need torun the apt-get commands w ith : . sudo s u d o a p t - g e tI f you are still getting this issue after running w ith sudo, try runningand then . Sometimes ifa process that has lock on or and it quits suddenly, it causes issues, as the lock fileisn' t removed like it should.s u d o r m / v a r / l i b / a p t / l i s t s / l o c k s u d o r m / v a r / l i b / d p k g / l o c k s u d o a p t - g e t d p k g a p t - g e tTo ex plain file locks, it' s basically a w ay of keeping certain files and softw are from being accessedand modified by multiple things (softw are or people) at once. You can read for a more in-depthex planation.

Configure Network Settings on Raspberry Pi HardwareYou can resolve network connectivity issues by inspecting and editing the IP configuration of the Raspberry Pi Ethernet port.To configure these settings when you are first setting up your Raspberry Pi hardware, seeReplace Firmware on Raspberry Pi Hardware.You may need to reconfigure the IP settings if your board: Has unknown IP settings Is unreachable using a network connection Is being moved to a network or direct Ethernet connection that uses static IP settings Is being moved from a network that used static IP settings to one that uses DHCP servicesThere are several conditions under which networks use DHCP or static IP settings: Use DHCP services If your board is connected to a network with DHCP services, such as an office LAN or a home network connected to the Internet. DHCP is a network service that automatically configures the IP settings of Ethernet devices connected to a network. Use static IP settings If your board is directly connected to an Ethernet port on your computer or connected to an isolated network without DHCP services.To configure the board to use DHCP or static IP settings:1. You can use a terminal window after accessing the Linuxdesktop. SeeAccess the Linux Desktop Using Computer Peripherals.2. Display the contents of the/etc/network/interfacesfile. Enter:cat /etc/network/interfaces If the board is configured to use DHCP services (the default configuration),dhcpappears at the end of the following line:iface eth0 inet dhcpIf the board is configured to use static IP settings,staticappears at the end of the following line:iface eth0 inet static

3. Create a backup of the /etc/network/interfaces file. Enter:sudo cp /etc/network/interfaces /etc/network/interfaces.backupIf prompted, enter the root password.4. Editinterfacesusing a simple editor callednano. Enter:sudo nano /etc/network/interfaces5. Edit the last word of line that starts withiface eth0 inet.To use DHCP services, change the line to:iface eth0 inet dhcpTo use static IP settings, change the line to:iface eth0 inet static6. For static IP settings, add lines foraddress,netmask, andgateway. For example:7. iface eth0 inet static8. address 192.168.1.29. netmask 255.255.255.0 gateway 192.168.1.1For static IP settings: The value of the subnet mask must be the same for all devices on the network. The value of the IP address must be unique for each device on the network.For example, if the Ethernet port on your host computer has a network mask of255.255.255.0and a static IP address of192.168.1.1, set: netmaskto use the same network mask value,255.255.255.0. addressto an unused IP address, between192.168.1.2and192.168.1.254.10. Save the changes and exitnano:j. PressCtrl+X.j. EnterYto save the modified buffer.j. For "File Name to Write: /etc/network/interfaces", pressEnter.j. Thenanoeditor confirms that it "Wrote # lines" and returns control to the command line.1. Reboot the board. In MATLABCommand Window, enter:1. h = raspberrypih.execute('sudo shutdown -r now')1. Test the IP settings by logging in to the board over a telnet session.Tip You can use theifconfigcommand to temporarily change the IP settings. Rebooting the board removes theifconfigsettings and restores the/etc/network/interfacessettings.To change the IP settings temporarily, open a Linux command line. Enterifconfig, the device id, a valid IP address,netmask, and the appropriate network mask. For example:ifconfig eth0 192.168.45.12 netmask 255.255.255.0