I'm trying to use my Raspberry Pi 2 to broadcast an ad-hoc network that my laptop can connect to and use for file transfer and SSH. This connection does not need to provide internet access to the laptop. I have succeeded at creating this ad-hoc network by modifying /etc/network/interfaces
and running a DHCP server on wlan0
. I am using isc-dhcp-server
to accomplish this.
This is my /etc/network/interfaces
setup:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.2
wireless-channel 3
wireless-essid Test-Network
wireless-mode ad-hoc
#allow-hotplug wlan0
#iface wlan0 inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
This is my /etc/dhcp/dhcpd.conf
setup:
ddns-update-style none;
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.50;
option broadcast-address 192.168.1.1;
option routers 192.168.1.1;
}
This is my /etc/default/isc-dhcp-server
setup:
DHCPD_CONF=/etc/dhcp/dhcpd.conf
INTERFACES="wlan0"
Everything else in the above files is commented out (and not included in this post).
The problem I'm having involves using eth0
to connect to the internet. I plug in eth0
to update packages, pull git repositories, etc. This is important for keeping my Raspberry Pi maintained.
When I plug in an active Ethernet cable to eth0
, I don't get any internet connection on the Raspberry Pi. The ad-hoc network still runs, and I can connect and ssh at 192.168.1.1, but the Pi has no internet access.
I've successfully gotten an internet connection using eth0
by disabling the ad-hoc network, but I need both working at the same time.
Any suggestions?