Access Internet When Raspberry Pi Is Directly Connected to Computer Using Ethernet
When Raspberry Pi® hardware is directly connected to a computer using an Ethernet cable, perform these steps to access the Internet from the hardware.
Connect the Raspberry Pi hardware to a wireless network.
Open a Secure Shell (SSH) command-line session with the hardware using the IP address as
169.254.0.2
. This is the static IP address assigned to the hardware during the Hardware Setup process for direct connection.r = raspberrypi('169.254.0.2','pi','raspberry'); openShell(r);
Here,
raspberry
andpi
are the default user name and password of the Raspberry Pi hardware.From the routing table, delete the default route,
0.0.0.0
. The hardware uses this route to access external hosts.sudo ip route del 0.0.0.0/0
Check if the hardware is now connected to the Internet by executing the
ping
command on the Google® DNS IP address,8.8.8.8
. A successful response indicates that the hardware is connected to the Internet.ping 8.8.8.8