{"id":636,"date":"2012-10-19T10:46:44","date_gmt":"2012-10-19T10:46:44","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=636"},"modified":"2023-12-11T13:33:36","modified_gmt":"2023-12-11T13:33:36","slug":"configuring-network-adaptors","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/programming-in-c\/tcpip\/configuring-network-adaptors","title":{"rendered":"Configuring Network Adaptors"},"content":{"rendered":"<h4>Editing Network Adaptor Settings<\/h4>\n<h4>Restarting After Changes<\/h4>\n<p>After changes to the network interface configuration, you have to restart the network interface using this (assuming the interface is called &#8220;eth0&#8221;).<\/p>\n<pre><code>sudo ip link set eth0 down &amp;&amp; sudo ip link set eth0 up<\/code><\/pre>\n<h4>Assigning A Manual IP Address<\/h4>\n<p>For recent\u00a0versions of\u00a0Raspbian \/etc\/network\/interfaces should no longer be edited &#8211; it must be left as default (all adaptors set to &#8216;manual&#8217;). \u00a0Network interface addresses are now being controlled by the DHCP client dhcpcd5 instead of using the interfaces file<\/p>\n<pre><code>\nsudo nano \/etc\/dhcpcd.conf\n<\/code><\/pre>\n<p>Add this for\u00a0eth0 or wlan0 with your own settings as required<\/p>\n<pre><code>\n#ASSIGN A MANUAL IP ADDRESS INSTEAD OF USING DHCP\ninterface eth0\n   static ip_address=192.168.1.20\/24\n   static routers=192.168.1.1\n   static domain_name_servers=192.168.1.1\n<\/code><\/pre>\n<p><em>(The \/24 indicates the first 24 bits are also\u00a0the subnet mask).<\/em><\/p>\n<p><em>By setting\u00a0ip_address,\u00a0dhcpcd\u00a0will then not attempt to obtain a lease and just use the value for the\u00a0address with an infinite lease time.<\/em><\/p>\n<p>Press CTRL+X to save and exit.<\/p>\n<p>You can find more info on the configuration possibilities\u00a0<a href=\"https:\/\/www.daemon-systems.org\/man\/dhcpcd.conf.5.html\">here<\/a>.<\/p>\n<h4>Manually Configuring WiFi<\/h4>\n<p><a href=\"https:\/\/raspberry-projects.com\/pi\/pi-operating-systems\/raspbian\/network-settings\/configuring-wifi\">See here<\/a>.<\/p>\n<h4><span style=\"color: #d3d3d3;\">DHCP vs Manual IP Settings &#8211; Pre Raspbian Jessie (old versions)<\/span><\/h4>\n<pre><span style=\"color: #d3d3d3;\"><code>\niface eth0 inet dhcp\n<\/code><\/span><\/pre>\n<p><span style=\"color: #d3d3d3;\">or<\/span><\/p>\n<pre><span style=\"color: #d3d3d3;\"><code>\niface eth0 inet static\n     address ###.###.###.###\n     netmask ###.###.###.###\n     gateway ###.###.###.###\n\n<\/code><\/span><\/pre>\n<h4><span style=\"color: #d3d3d3;\">WiFi Adaptor Setup &#8211; Pre Raspbian Jessie (old versions)<\/span><\/h4>\n<p><span style=\"color: #d3d3d3;\">First make sure the system is up to date:<\/span><\/p>\n<pre><span style=\"color: #d3d3d3;\"><code>\nsudo apt-get update\n<\/code><\/span><\/pre>\n<p><span style=\"color: #d3d3d3;\">Open the interfaces file<\/span><\/p>\n<pre><span style=\"color: #d3d3d3;\"><code>\nsudo nano \/etc\/network\/interfaces\n<\/code><\/span><\/pre>\n<p><span style=\"color: #d3d3d3;\">Setup as follows:<\/span><\/p>\n<pre><span style=\"color: #d3d3d3;\"><code>\nauto lo\n\niface lo inet loopback\niface eth0 inet dhcp\n\nallow-hotplug wlan0\nauto wlan0\n\niface wlan0 inet dhcp\n     wpa-ssid \"YOUR_SSID\"\n     wpa-psk \"YOUR_KEY\"\n\niface default inet dhcp\n<\/code><\/span><\/pre>\n<h5><span style=\"color: #d3d3d3;\">Alternative Setup &#8211; Using A Fixed IP<\/span><\/h5>\n<pre><span style=\"color: #d3d3d3;\"><code>\n\nauto lo\n\niface lo inet loopback\niface eth0 inet dhcp\n\nallow-hotplug wlan0\nauto wlan0\n\niface wlan0 inet static\n     address 172.27.20.11\n     netmask 255.255.0.0\n     gateway 172.27.20.1\n     wpa-ssid \"YOUR_SSID\"\n     wpa-psk \"YOUR_KEY\"\n\niface default inet dhcp\n<\/code><\/span><\/pre>\n<h5><span style=\"color: #d3d3d3;\">Alternative Setup &#8211; Using a hidden SSID and need to specify all of the WiFi settings<\/span><\/h5>\n<pre><span style=\"color: #d3d3d3;\"><code>\nauto lo\n \niface lo inet loopback\niface eth0 inet dhcp\n \nauto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n   wpa-scan-ssid 1\n   wpa-ap-scan 1\n   wpa-key-mgmt WPA-PSK\n   wpa-proto RSN WPA\n   wpa-pairwise CCMP TKIP\n   wpa-group CCMP TKIP\n   wpa-ssid \"YOUR_SSID\"\n   wpa-psk \"YOUR_KEY\"\n\niface default inet dhcp\n<\/code><\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Editing Network Adaptor Settings Restarting After Changes After changes to the network interface configuration, you have to restart the network interface using this (assuming the interface is called &#8220;eth0&#8221;). sudo ip link set eth0 down &amp;&amp; sudo ip link set eth0 up Assigning A Manual IP Address For recent\u00a0versions of\u00a0Raspbian \/etc\/network\/interfaces should no longer be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,31],"tags":[],"class_list":["post-636","post","type-post","status-publish","format-standard","hentry","category-network-settings","category-tcpip"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=636"}],"version-history":[{"count":25,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/636\/revisions"}],"predecessor-version":[{"id":3703,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/636\/revisions\/3703"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}