antpoli
Posts: 24
Joined: Fri Aug 28, 2015 8:13 am
Location: Pomezia - Italy

Re: Configuring dhcpcd in Raspbian Stretch

Thu Nov 02, 2017 1:46 pm

Passphrase is double quoted.
I will review /etc/network/interfaces and /etc/dnsmasq.conf

Tks

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Thu Nov 02, 2017 1:50 pm

When you are editing these files, insure you are using a true text editor. Sometimes double quotes are the wrong character.

I use Ubuntu OS and nano as the editor.

antpoli
Posts: 24
Joined: Fri Aug 28, 2015 8:13 am
Location: Pomezia - Italy

Re: Configuring dhcpcd in Raspbian Stretch

Thu Nov 02, 2017 4:59 pm

I use nano as well.

Actually psk passphrase is recognized correctly and pi creates the WLAN and accept clients but is not able to assign IP address to clients, neither it has an IP address

antpoli
Posts: 24
Joined: Fri Aug 28, 2015 8:13 am
Location: Pomezia - Italy

Re: Configuring dhcpcd in Raspbian Stretch

Thu Nov 02, 2017 5:30 pm

SOLVED!

the problem was on the position where I inserted "deny interface wlan1" in /etc/dhcpcd.conf.
It shall have to be placed at the end of the file.

thanks for support

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Fri Nov 03, 2017 11:51 am

antpoli wrote: SOLVED!

the problem was on the position where I inserted "deny interface wlan1" in /etc/dhcpcd.conf.
It shall have to be placed at the end of the file.

thanks for support
Hope that is a typo. That should be

Code: Select all

denyinterfaces wlan1
and it should be near the top of the file before any interface declarations.

beandip408
Posts: 8
Joined: Wed Aug 02, 2017 4:48 am

Re: Configuring dhcpcd in Raspbian Stretch

Thu Nov 09, 2017 3:49 am

after reading these posts with so much great information, i am now more confused than ever. i have a pi3 and need to make an access point from either the USB wifi or onboard, and have the other able to connect to wifi. im not sure which of these posts to follow for this kind of setup. any information would be great. thanks.

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Thu Nov 09, 2017 10:59 am

I have a setup with the onboard wifi as an AP and a usb wireless device as a client route to the internet. You should start a new thread or watch this one.
viewtopic.php?f=36&t=197212

inspire1
Posts: 9
Joined: Thu Feb 12, 2015 8:47 pm

Re: Configuring dhcpcd in Raspbian Stretch

Sat Dec 16, 2017 1:07 pm

This thread has been very useful and helped me get a complex networking Pi2 work perfectly.
ETH0 - dhcp
WLAN0 - dhcp (this pi may be used somewhere without wired network available)
WLAN1 - used by hostapd giving our private addresses.

Pretty much the description by SurferTim is perfect, but I would add the three following observations:

1) In my case although the interfaces all came up correctly the AP wouldn't start until I renamed 'wpa_supplicant.conf' to 'wpa_supplicant-wlan0.conf'
2) The firewall rules (iptables) needed to be duplicated for masquerading to both eth0 and wlan0
3)The firewall rules are not persistent and are lost on reboot. The solution is to install iptables-persistent which will not only process the rules on every boot but will actually save them during installation although you could use sudo bash -c "iptables-save > /etc/iptables/rules.v4"

Thanks again to SurferTim and I hope these notes can help others struggling with the 'stretch' way of networking :-)

sandmonster
Posts: 4
Joined: Fri Dec 29, 2017 7:15 pm
Contact: Website

Re: Configuring dhcpcd in Raspbian Stretch

Sat Dec 30, 2017 1:37 pm

Apologies if this is a complete noob question, but then I am virtually that (haven't played with linux for about 30 years!)

Is the following all you need to do to get a wireless AP working? Or do I need to do something with WPA_supplicant also?
- I want to be able to access internet via eth0 through the AP - I initially followed this guide (https://learn.adafruit.com/setting-up-a ... t/overview, but although I got an access point I could connect to from my phone, it stopped the eth0 from working and I couldn't find out what to change to get it working so I restored the system from a back up and am starting again! :|


SurferTim wrote:
Wed Aug 30, 2017 1:34 pm
I have my RPi3 working as an AP with one caveat. The dnsmasq service will not start on boot.
Edit: Fixed boot problem. See new /etc/dnsmasq.conf below.

DO NOT MODIFY /etc/network/interfaces FILE!

My /etc/dhcpcd.conf addition:

Code: Select all

interface wlan0
static ip_address=192.168.4.1/24
static routers=192.168.4.1
static domain_name_servers=8.8.8.8
My /etc/dnsmasq.conf file

Code: Select all

interface=wlan0
domain-needed
bogus-priv
dhcp-range=192.168.4.8,192.168.4.250,12h
My /etc/hostapd/hostapd.conf file

Code: Select all

interface=wlan0
driver=nl80211
ssid=RPiNet
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mypassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Edit /etc/default/hostapd and change this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
The next section is required only if you are wanting to access the internet through the ethernet connection.

Edit /etc/sysctl.conf and uncomment

Code: Select all

net.ipv4.ip_forward=1
My iptables rules. Replace ethX with your ethernet interface name from ifconfig.

Code: Select all

sudo iptables -t nat -A  POSTROUTING -o ethX -j MASQUERADE
sudo iptables -A FORWARD -i ethX -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o ethX -j ACCEPT
Edit: Changed masquerade to MASQUERADE.
One other question - how do you find out what driver your WIFI adapter needs - mine is based on ralink RT55572? (I have currently got both eth0 and wlan0 working as connections to the router - so maybe the driver is ok). ifconfig gives:

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.23  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::366b:12ea:4cc6:a013  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:1a:6c:88  txqueuelen 1000  (Ethernet)
        RX packets 3623  bytes 238945 (233.3 KiB)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 2494  bytes 476376 (465.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 9  bytes 524 (524.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9  bytes 524 (524.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.25  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::b4f5:8879:5b81:635d  prefixlen 64  scopeid 0x20<link>
        ether 24:05:0f:34:45:49  txqueuelen 1000  (Ethernet)
        RX packets 6694  bytes 593006 (579.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 237  bytes 18194 (17.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

My list of setup aid memoirs: https://github.com/toomuchsand/Pi_Tips

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Sat Dec 30, 2017 2:18 pm

You have a routing problem. You have eth0 and wlan0 assigned the same subnet.

I have found only the nl80211 driver works.

sandmonster
Posts: 4
Joined: Fri Dec 29, 2017 7:15 pm
Contact: Website

Re: Configuring dhcpcd in Raspbian Stretch

Sun Dec 31, 2017 10:52 am

Sorry, probably didn't make it clear - that ifconfig result is with the pi connected to WIFI, as a client *before* setting it up as access point.

Because I tried once and failed, I wanted to check the sequence of actions before I started.

I am going to try and follow this: https://www.raspberrypi.org/documentati ... et-sharing
but this looks like it still makes changes to /etc/interfaces which it seems you don't do with latest raspbian stretch?
My list of setup aid memoirs: https://github.com/toomuchsand/Pi_Tips

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Sun Dec 31, 2017 12:09 pm

Don't follow that doc. It doesn't work with Stretch. These do.
https://github.com/SurferTim/documentat ... s-point.md

sandmonster
Posts: 4
Joined: Fri Dec 29, 2017 7:15 pm
Contact: Website

Re: Configuring dhcpcd in Raspbian Stretch

Mon Jan 01, 2018 7:32 pm

SurferTim wrote:
Sun Dec 31, 2017 12:09 pm
Don't follow that doc. It doesn't work with Stretch. These do.
https://github.com/SurferTim/documentat ... s-point.md
That worked - Thanks :D
My list of setup aid memoirs: https://github.com/toomuchsand/Pi_Tips

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Fri Jan 05, 2018 11:07 am

You can follow that doc now. It has been replaced with mine.
https://www.raspberrypi.org/documentati ... s-point.md

Tokogon
Posts: 2
Joined: Sat Jan 06, 2018 6:02 pm

Re: Configuring dhcpcd in Raspbian Stretch

Sat Jan 06, 2018 6:26 pm

SurferTim wrote:
Fri Jan 05, 2018 11:07 am
You can follow that doc now. It has been replaced with mine.
https://www.raspberrypi.org/documentati ... s-point.md
So I was doing well with this guide on my Raspberry Pi 3 until the last section on "Using the Raspberry Pi as an access point to share an internet connection". What confused me a bit was the editing of the "hostapd.conf" file. Do I completely replace the previous changes earlier in the guide with the new bridge ones or add them at the bottom somewhere? I tried connecting to my AP after replacing it all with the bridge info, but I kept getting an error about my password being incorrect despite retyping it several times in the config.

And one small tiny question, is it possible to make my Pi a wired and wireless access point at the same time with this guide? And if I had a better USB antenna than the one included on the Pi how would I find out its device name?

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Sat Jan 06, 2018 8:13 pm

Use the whole first example, replacing the driver with bridge.

They didn't make that very clear.

I'm not certain what you mean about the wired/wireless access point. Can you be more specific about what you want to do?

Edit: Your password must be at least 8 characters long. Could that be your problem?

Tokogon
Posts: 2
Joined: Sat Jan 06, 2018 6:02 pm

Re: Configuring dhcpcd in Raspbian Stretch

Sun Jan 07, 2018 4:36 am

SurferTim wrote:
Sat Jan 06, 2018 8:13 pm
I'm not certain what you mean about the wired/wireless access point. Can you be more specific about what you want to do?
I want to possibly make a WireGuard or Tor router (with my Pi) connected by Ethernet to my home router and be able to connect devices to the Pi via WiFi or Ethernet.

pioff
Posts: 1
Joined: Sat Jan 13, 2018 7:31 am

Re: Configuring dhcpcd in Raspbian Stretch

Sat Jan 13, 2018 7:55 am

Anyone got a guide to setting up the config file so my DHCP server allocates the ip. The latest raspbian comes pre installed with empty network conf files and no matter what I set in there, I get no internet.

Anyone else having the same issue?

sandmonster
Posts: 4
Joined: Fri Dec 29, 2017 7:15 pm
Contact: Website

Re: Configuring dhcpcd in Raspbian Stretch

Sat Jan 13, 2018 8:04 am

Tokogon wrote:
Sat Jan 06, 2018 6:26 pm
SurferTim wrote:
Fri Jan 05, 2018 11:07 am
You can follow that doc now. It has been replaced with mine.
https://www.raspberrypi.org/documentati ... s-point.md
So I was doing well with this guide on my Raspberry Pi 3 until the last section on "Using the Raspberry Pi as an access point to share an internet connection". What confused me a bit was the editing of the "hostapd.conf" file. Do I completely replace the previous changes earlier in the guide with the new bridge ones or add them at the bottom somewhere? I tried connecting to my AP after replacing it all with the bridge info, but I kept getting an error about my password being incorrect despite retyping it several times in the config.

And one small tiny question, is it possible to make my Pi a wired and wireless access point at the same time with this guide? And if I had a better USB antenna than the one included on the Pi how would I find out its device name?
On my setup the hostapd.conf looks like:

Code: Select all

interface=wlan0
bridge=br0
#driver=nl80211
ssid=NameOfNetwork
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=********************
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
This gives me wired ethernet between my pi and the cable router and WIFI access from other devices to the pi (and thus onward to the local network and to the internet)

@SurferTim - could you explain where you would define a static IP (for the pi - eth0)?
My list of setup aid memoirs: https://github.com/toomuchsand/Pi_Tips

SurferTim
Posts: 1268
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Configuring dhcpcd in Raspbian Stretch

Sat Jan 13, 2018 10:29 am

If you are using a bridge (br0) access point, you assign static network settings to the bridge in /etc/dhcpcd.conf.

Code: Select all

interface br0
static ip_address=192.168.1.253/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 17 guests