{"id":2222,"date":"2015-10-01T20:17:06","date_gmt":"2015-10-01T20:17:06","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=2222"},"modified":"2018-05-15T18:29:43","modified_gmt":"2018-05-15T18:29:43","slug":"multiple-network-adaptors","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/pi-operating-systems\/raspbian\/network-settings\/multiple-network-adaptors","title":{"rendered":"Multiple Network Adaptors"},"content":{"rendered":"<h4>\nUsing eth0 and wlan0<br \/>\n<\/h4>\n<p>\nThis can be problematic with Raspbian. &nbsp;We have found out the hard way that using DHCP&nbsp;on both adaptors results in eth0 working fine but the gateway IP address assigned by wlan0 DHCP being completely&nbsp;ignored and when using wlan0 to send packets the Linux&nbsp;OS sends&nbsp;ARP requests assuming that any destination IP address is on the local network, instead of passing packets to the gateway as it should. &nbsp;We haven&#39;t found a fix to this other than to not use DHCP or to issue&nbsp;the following command to assign the gateway IP address to wlan0&nbsp;programatically&nbsp;each time&nbsp;after it connects (its volatile):\n<\/p>\n<pre>\r\n<code>\r\nsudo route add default gw 192.168.1.1 wlan0\r\n<\/code><\/pre>\n<h4>\nForcing Fixed Network Adapter Names<br \/>\n<\/h4>\n<p>\nUnfortunately wlan0&nbsp;is not always the onboard WiFi on a RPi. We&#39;ve found issues using the onboard WiFi to create an access point and&nbsp;an additional plug in USB WiFi dongle to connect to a different WiFi network where wlan0&nbsp;is randomly allocated on power-up and restart.&nbsp; In our experiences (with Raspbian&nbsp;Jesse and a RPI3)&nbsp;removing the HDMI monitor could cause allocation to change when next rebooting.&nbsp; There are well knows ways to allocate&nbsp;WiFi adaptor based on MAC address but this isn&#39;t helpful when running on lots of different RPi&#39;s.&nbsp; The following is based on the excellent guide at <a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=36&amp;t=198946\">https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=36&amp;t=198946<\/a> and allocates the adaptors based on physical&nbsp;USB port.\n<\/p>\n<p>\nSwitch off systemd-predictable mechanism stuff&nbsp;\n<\/p>\n<pre>\r\n<code>\r\nsudo ln -nfs \/dev\/null \/etc\/systemd\/network\/99-default.link\r\n<\/code><\/pre>\n<p>\nNow setup udev rules that uniquely identify the interfaces based on their USB connector positions.&nbsp; Create the file:\n<\/p>\n<pre>\r\n<code>\r\nsudo nano \/etc\/udev\/rules.d\/72-wlan-geo-dependent.rules\r\n<\/code><\/pre>\n<p>\nPaste the following into it:\n<\/p>\n<pre>\r\n<code>\r\n#\r\n# +-----+---------------+\r\n# |     | wlan4 | wlan3 |\r\n# |RJ45 +-------+-------+\r\n# |     | wlan2 | wlan1 |\r\n# +-----+---------------+ (RPI USB ports with position dependent device names for up to 4 optional wifi dongles)\r\n# \r\n# | wlan0 | (onboard wifi)\r\n#\r\nACTION==&quot;add&quot;, SUBSYSTEM==&quot;net&quot;, SUBSYSTEMS==&quot;sdio&quot;, KERNELS==&quot;mmc1:0001:1&quot;, NAME=&quot;wlan0&quot;\r\nACTION==&quot;add&quot;, SUBSYSTEM==&quot;net&quot;, SUBSYSTEMS==&quot;usb&quot;,  KERNELS==&quot;1-1.2&quot;,       NAME=&quot;wlan4&quot;\r\nACTION==&quot;add&quot;, SUBSYSTEM==&quot;net&quot;, SUBSYSTEMS==&quot;usb&quot;,  KERNELS==&quot;1-1.4&quot;,       NAME=&quot;wlan3&quot;\r\nACTION==&quot;add&quot;, SUBSYSTEM==&quot;net&quot;, SUBSYSTEMS==&quot;usb&quot;,  KERNELS==&quot;1-1.3&quot;,       NAME=&quot;wlan2&quot;\r\nACTION==&quot;add&quot;, SUBSYSTEM==&quot;net&quot;, SUBSYSTEMS==&quot;usb&quot;,  KERNELS==&quot;1-1.5&quot;,       NAME=&quot;wlan1&quot;\r\n<\/code><\/pre>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using eth0 and wlan0 This can be problematic with Raspbian. &nbsp;We have found out the hard way that using DHCP&nbsp;on both adaptors results in eth0 working fine but the gateway IP address assigned by wlan0 DHCP being completely&nbsp;ignored and when using wlan0 to send packets the Linux&nbsp;OS sends&nbsp;ARP requests assuming that any destination IP address [&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],"tags":[],"class_list":["post-2222","post","type-post","status-publish","format-standard","hentry","category-network-settings"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/2222","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=2222"}],"version-history":[{"count":4,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/2222\/revisions"}],"predecessor-version":[{"id":2904,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/2222\/revisions\/2904"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=2222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=2222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=2222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}