Författare:
Per Stenebo
Skapad:
2014-10-14 19:16:25
Ändrad:
2022-02-16 18:48:31
en

Networking in Raspberry Pi with Raspbian OS

| Ubuntu dhcpcd.conf man page | Debian Network Configuration | Debian Network Manager | raspberrypi.org forum |

/etc/networking/interface or /etc/dhcp/dhclient.conf

Internal pages: | Ubuntu server |

MAC address for eth0 and wlan0 always start with b8:27:eb:

Troubleshooting

Check log for dhcp: journalctl | grep -Ei 'dhcp'

 

Config static ip

Modify standard interface to static ip:

sudo nano /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8

Create alias interface with static ip:

sudo nano /etc/network/interfaces

auto eth0:0
iface eth0:0 inet static
address 192.168.0.10

 

WiFi

| howto |

sudo systemctl status wpa_supplicant.service

 

lsusb with nothing attached

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.

 

Check SSID for available wireless networks:

sudo iwlist wlan0 scan | grep ESSID

Config wifi: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

The following works with WPA-personal, WPA auto mode (WPA or WPA2), TKIP and AES:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=SE

network={
	ssid="theESSID"
	psk="thePassword"
	key_mgmt=WPA-PSK
}

Restart to activate the new config:

sudo ifdown wlan0 && sudo ifup wlan0

Check result with:

ip a

 

Set different hostnames for each connection (did not work when tested 2014-10-15)

sudo nano /etc/dhcp/dhclient.conf

#send host-name = gethostname();

.....

interface "eth0" {
        send host-name = gethostname();
}

interface "wlan0" {
        send host-name = "raspi_wlan0";
}

 

Raspberry Pi as AP (wifi access point)

| adafruit (isc-dhcp-server) | Raspberry Pi HQ (isc-dhcp-server) | elinux (udhcpd) |

Message thru apt-listchanges 2017-11-28:

  The plan is to deprecate /etc/default/hostapd at some point, making
  /etc/hostapd/hostapd.conf the standard location for the configuration
  file.

 

Kommentarer till sidan Network and WiFi