This work is licensed under a Creative Commons Attribution 4.0 International License.
The solution is based on running DHCP service at your workstation (your notebook for example), and use it to attribute an IP address to your Raspberry Pi/Odroid. Then use ssh to connect to your Raspberry Pi/Odroid through this IP address.
Terminology | Explaination |
---|---|
Client | Your Single Board Computer, such as a Raspberry Pi or an Odroid |
Server | Your workstation with any linux based systems, like Ubuntu |
- Enable SSH connection
- for Raspberry Pi
sudo systemctl enable ssh
- for Odroid
find the line
sudo vim /etc/ssh/sshd_config
PermitRootLogin
and set it toPermitRootLogin yes
- Modify DHCP Client configuration
fin the linesudo vim /etc/dhcp/dhclient.conf
send host-name "foo";
and uncommented it
-
Install a DHCP server
sudo apt-get install isc-dhcp-server
-
Use
ifconfig
to find your Ethernet network interface, it's probably eth0 but in my case it's enp61s0, then you need to configure a subnetwork on this interface -
Backup your interface configuration file
sudo cp /etc/network/interfaces /etc/network/interfaces.original
-
Modify interface configuration file
sudo vim /etc/network/interfaces
which should be modified like the output below
auto lo iface lo inet loopback iface enp61s0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0
-
Backup your configuration file of DHCP service
sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.original
-
Modify the configuration file of DHCP service
sudo vim /etc/dhcp/dhcpd.conf
which should be modified like the output below
ddns-update-style none; default-lease-time 3600; max-lease-time 7200; authoritative; subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1.1; range 192.168.1.100 192.168.1.200; }
-
Start the DHCP service by typing
# bring up the enp61s0 interface sudo ifup enp61s0 # start DHCP service sudo service isc-dhcp-server start # enable forwarding from the ethernet to wireless router sudo /sbin/iptables --table nat -A POSTROUTING -o wlan0 -j MASQUERADE
-
Now plug your Raspberry Pi or or Odroid and open another terminal and tape
tail -f /var/log/sys/log
to test the connection, you should see an entry like
Dec 3 21:51:24 jzhou-Alienware-15-R3 dhcpd[10817]: DHCPACK on 192.168.1.100 to 00:1e:06:cb:e0:f5 (foo) via enp61s0
-
Then you can connect to your Raspberry Pi or or Odroid by
- for Odroid
ssh [email protected]
- for Raspberry Pi
ssh [email protected]
- for Odroid