2

I followed this link for setting my Raspberry Pi as an Access Point:

http://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/

Below are my configuration:

/etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    gateway 192.168.1.1

up iptables-restore < /etc/iptables.ip4.nat

/etc/dhcp/dhcp.conf

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.3 192.168.1.254;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}

/etc/hostapd/hostapd.conf

interface=wlan0
ssid=RPi
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=myownkey
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
driver=nl80211
ieee80211n=1
hw_mode=g

ifconfig -a

eth0      Link encap:Ethernet  HWaddr b8:27:eb:14:1d:81  
          inet addr:192.168.1.16  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:332 errors:0 dropped:0 overruns:0 frame:0
          TX packets:301 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:29981 (29.2 KiB)  TX bytes:38489 (37.5 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:9612 (9.3 KiB)  TX bytes:9612 (9.3 KiB)

mon.wlan0 Link encap:UNSPEC  HWaddr 7C-DD-90-03-75-EE-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:130 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14064 (13.7 KiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 7c:dd:90:03:75:ee  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:353 errors:0 dropped:0 overruns:0 frame:0
          TX packets:278 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:35307 (34.4 KiB)  TX bytes:26632 (26.0 KiB)

I have WIFI dongle plugged into RPI USB port. When my RPI boots up I am able to access my newly created WIFI network "RPi" (as per config above). The client does gets assigned a new address - in my case it was 192.168.1.3. But I am neither able to ping other systems from my RPI or clients who join RPi WIFI network:

From RPI:

root@raspberrypi:~# ping 198.168.1.92
connect: Network is unreachable
root@raspberrypi:~# 

From 198.168.1.3:

# ping 198.168.1.92
From 192.168.2.3 ... Destination Host Unreachable

How can I correct the same? Also is it possible to assign clients a set of different network address say from range - 107.0.0.1 to 107.0.0.254?

  • Could you please clarify - are you able to ping RPI from Wifi client (is it possible to ping 192.168.1.2 from 192.168.1.92, for example)? – Krzysztof Adamski Dec 18 '13 at 11:10
  • Yes the same is possible and is working fine – Sanjay Dec 18 '13 at 11:34
  • Is it possible that configuration of the devices that are connected to the Wifi does not permit responding to ping messages? It is quite likely in Windows devices, for example. – Krzysztof Adamski Dec 18 '13 at 12:49
1

Changing IP range for clients

If you want to change IP address range for clients you have to do the following:

  1. Assign your RPi an address from the desired range. You can do this by changing address setting in /etc/network/interfaces. Let's say it's 107.0.0.2 in your case.
  2. Change the range that DHCP server is giving to the clients in /etc/dhcp/dhcp.conf:
    • change subnet setting from 192.168.0.0 to appriopriate network address (in your case 107.0.0.0) and possibly a netmask
    • change range option to match your range (in your case it should be set to 107.0.0.3 107.0.0.254
    • change option broadcast-address, in your case to 107.0.0.255 (if your mask is 255.255.255.0
    • change option routers to match your configuration (your router address), in your case to 107.0.0.1

Reboot the RaspberryPi and everything should be working.

  • Yes it works fine for changing the IP address range – Sanjay Dec 18 '13 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.