wellenvogel / avnav

using the raspberry pi as a nav computer
MIT License
85 stars 26 forks source link

How to change the ipadres of wlan0 #335

Open Fietsenwiel opened 5 months ago

Fietsenwiel commented 5 months ago

I installed an new image of AvNav. The ip adres of wlan0 is 192.168.60.10.

I like to change that and I see you can change that in: /etc/network/interfaces.d/wlan0

Its working (ifconfig shows the new ipadres) but connecting is not possible anymore. So I think it has to be change anywhere else too, maybe the dhcp server?

Can you please help me in the right direction?

free-x commented 5 months ago

don't know why you need this to do

Don't forget to reboot

Regards free-x

Fietsenwiel commented 5 months ago

Thanks for your fast reaction.

I changed 192.168.60.10 in my own ipadress (10.10.10.1) In /etc/dnsmasq.d/avnav-dnsmasq.conf of course only 192.168.60 for 10.10.10 But then still I can't connect...

Thanks in advance.

Greeting

Lschip

Op wo 10 apr 2024 om 16:13 schreef free-x @.***>:

don't know why you need this to do

  • /etc/network/interfaces.d/wlan0
  • /etc/dnsmasq.d/avnav-dnsmasq.conf
  • /etc/iptables.ipv4.nat

Don't forget to reboot

Regards free-x

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2047665467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YWLZTR2DV3EAZW7FLTY4VCGZAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBXGY3DKNBWG4 . You are receiving this because you authored the thread.Message ID: @.***>

free-x commented 5 months ago

Could you provide Output of "ifconfig", "route -n", your changed config files?

Regards free-x

Fietsenwiel commented 5 months ago

@.***:~ $ ifconfig eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether dc:a6:32:b2:9b:cd txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0:avahi: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 169.254.14.92 netmask 255.255.0.0 broadcast 169.254.255.255 ether dc:a6:32:b2:9b:cd txqueuelen 1000 (Ethernet)

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

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.10.10.1 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::20f:55ff:fea8:9e0 prefixlen 64 scopeid 0x20 ether 00:0f:55:a8:09:e0 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 748 bytes 280078 (273.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan-av1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.198 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::dea6:32ff:feb2:9bce prefixlen 64 scopeid 0x20 ether dc:a6:32:b2:9b:ce txqueuelen 1000 (Ethernet) RX packets 6214 bytes 1618886 (1.5 MiB) RX errors 0 dropped 2 overruns 0 frame 0 TX packets 5429 bytes 2024562 (1.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

@.***:~ $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.2 0.0.0.0 UG 10 0 0 wlan-av1 0.0.0.0 0.0.0.0 0.0.0.0 U 1002 0 0 eth0 10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan-av1

cat /etc/network/interfaces.d/wlan0

allow-hotplug wlan0 iface wlan0 inet manual wireless-power off up /sbin/ip -4 addr replace 10.10.10.1/24 dev $IFACE || true up /usr/lib/avnav/raspberry/hostapd $IFACE down /usr/lib/avnav/raspberry/hostapd -s $IFACE

@.***:~ $ cat /etc/dnsmasq.d/avnav-dnsmasq.conf interface=wlan0,wlan-ap,wlan-ap2,wlan1 domain=avnav dhcp-range=wlan-ap,10.10.10.20,10.10.10.254,255.255.255.0,12h dhcp-range=wlan0,192.168.30.20,192.168.30.254,255.255.255.0,12h dhcp-range=wlan-ap2,192.168.40.20,192.168.40.254,255.255.255.0,12h dhcp-range=wlan1,192.168.50.20,192.168.50.254,255.255.255.0,12h dhcp-option=42,0.0.0.0 addn-hosts=/usr/lib/avnav/raspberry/hosts

@.***:~ $ cat /etc/iptables.ipv4.nat

Generated by iptables-save v1.4.21 on Tue Jul 19 03:16:26 2016

*nat :PREROUTING ACCEPT [0:0] :INPUT ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] -A PREROUTING -d 192.168.20.10/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -d 192.168.30.10/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -d 192.168.40.10/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -d 192.168.50.10/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -d 192.168.60.10/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -d 10.10.10.1/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A OUTPUT -p tcp -o lo --dport 80 -j REDIRECT --to-ports 8080 -A POSTROUTING -o wlan-av1 -j MASQUERADE -A POSTROUTING -o eth0 -j MASQUERADE -A POSTROUTING -o usb0 -j MASQUERADE COMMIT ..... .....

Op wo 10 apr 2024 om 17:35 schreef free-x @.***>:

Could you provide Output of "ifconfig", "route -n", your changed config files?

Regards free-x

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2047876186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YWPC3WLGYYIZYQL4ULY4VL5DAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBXHA3TMMJYGY . You are receiving this because you authored the thread.Message ID: @.***>

wellenvogel commented 5 months ago

Could you explain what you would like to achieve? There is alot of players in the game that need to function correctly. How do you connect when making the changes?

Fietsenwiel commented 5 months ago

Hi Andreas,

I always used this host adres (10.10.10.1) for connecting with the tablet(s) to the raspberry pi with AvNav. It's in my documentation, qr code on the boat and I have an arduino with this host adres fixed programmed.

So I thought it is easy to change the host adres and everything else stays the same...

Thanks in advance,

Lschip

Op wo 10 apr 2024 om 19:36 schreef Andreas Vogel @.***>:

Could you explain what you would like to achieve? There is alot of players in the game that need to function correctly. How do you connect when making the changes?

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2048117389, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YSILOIFSH3N6UNFNELY4V2AZAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGEYTOMZYHE . You are receiving this because you authored the thread.Message ID: @.***>

free-x commented 5 months ago

Do I understand correctly that you are migrating from OpenPlotter to AvNav Image?

wellenvogel commented 5 months ago

Sorry l don't get this completely... How did you set up a pi in the past to use this address? Finally you have to change the interface addresses, the dhcp config, the iptables stuff - as free-x mentioned. It's much simpler to rely on Bonjour aka avahi to connect. This way you can even change the ip setup without affecting the clients.

wellenvogel commented 5 months ago

btw: in your config you changed the ip for wlan0 but the dhcp for wlan-ap. You should check your client ip setup und routing to see if they could connect to your address...

Fietsenwiel commented 5 months ago

The previous installation was an raspberry pi image which I configured like I wanted to be and then I installed AvNav on it. But now I use the latest AvNaV image.

Your right about wlan0 an the wlan-ap. I want the accespoint to be my ip adres (10.10.10.1).

So changing /etc/network/interfaces.d/wlan0 is wrong then?

Op wo 10 apr 2024 om 20:07 schreef Andreas Vogel @.***>:

btw: in your config you changed the ip for wlan0 but the dhcp for wlan-ap. You should check your client ip setup und routing to see if they could connect to your address...

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2048166776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YSS7MIESEULMPPFLPLY4V5WPAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGE3DMNZXGY . You are receiving this because you authored the thread.Message ID: @.***>

free-x commented 5 months ago

@wellenvogel means your avnav-dnsmasq.conf should look like this interface=wlan0,wlan-ap,wlan-ap2,wlan1 domain=avnav dhcp-range=wlan-ap,192.168.60.20,192.168.60.254,255.255.255.0,12h dhcp-range=wlan0,10.10.10.20,10.10.10.254,255.255.255.0,12h dhcp-range=wlan-ap2,192.168.40.20,192.168.40.254,255.255.255.0,12h dhcp-range=wlan1,192.168.50.20,192.168.50.254,255.255.255.0,12h dhcp-option=42,0.0.0.0 addn-hosts=/usr/lib/avnav/raspberry/hosts

Fietsenwiel commented 5 months ago

Ok, I changed that according to your latest mail. I can see the accespoint but when I try to connect it does not. Still the same problem....

Op wo 10 apr 2024 om 20:34 schreef free-x @.***>:

@wellenvogel https://github.com/wellenvogel means your avnav-dnsmasq.conf should look like this interface=wlan0,wlan-ap,wlan-ap2,wlan1 domain=avnav dhcp-range=wlan-ap,192.168.60.20,192.168.60.254,255.255.255.0,12h dhcp-range=wlan0,10.10.10.20,10.10.10.254,255.255.255.0,12h dhcp-range=wlan-ap2,192.168.40.20,192.168.40.254,255.255.255.0,12h dhcp-range=wlan1,192.168.50.20,192.168.50.254,255.255.255.0,12h dhcp-option=42,0.0.0.0 addn-hosts=/usr/lib/avnav/raspberry/hosts

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2048205003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YVR7F236ZU6NZOB7F3Y4WA2LAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGIYDKMBQGM . You are receiving this because you authored the thread.Message ID: @.***>

wellenvogel commented 5 months ago

Could you please provide the info I have asked for - i.e. the client set up when connected to the AvNav wifi? Ip, routes...

Fietsenwiel commented 5 months ago

I'm lost now. I restored the original files but the problems stays. Now even the ap disappears and comes back al the time, connecting is not possible.

i now see this: @.***:~ $ ifconfig wlan-ap: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.30.10 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::20f:55ff:fea8:9e0 prefixlen 64 scopeid 0x20 ether 00:0f:55:a8:09:e0 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 243 bytes 70167 (68.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

@.***:~ $ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default RT-AC87U-19B0 0.0.0.0 UG 1 0 0 eth0 default RT-AC87U-19B0 0.0.0.0 UG 10 0 0 wlan-av1 link-local 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan-av1 192.168.30.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan-ap

It looks good.

The ap shows as "relexed1" while before it was "relexed"

I dont want to consume too much time off you so else I install from scratch (but is a lot of work with extra installed functionality)

Thanks in advance!

Op wo 10 apr 2024 om 21:30 schreef Andreas Vogel @.***>:

Could you please provide the info I have asked for - i.e. the client set up when connected to the AvNav wifi? Ip, routes...

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2048291541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YR72SMWOSAA6Z22LH3Y4WHOPAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGI4TCNJUGE . You are receiving this because you authored the thread.Message ID: @.***>

wellenvogel commented 5 months ago

For me it's still not really clear what you are trying to do. What do you mean with: the ap disappears and comes back al the time, connecting?

Do you talk about connecting to the AvNav wifi? Or about connecting with a browser? Would be really helpful to get a clear description about what exactly you are doing and what exactly does not work.

Fietsenwiel commented 5 months ago

Ok, I am sorry not to be clear enough.

First of all, it works again with the original configuration. First it didn't but my wifi dongle was in the wrong usb port, I corrected that.

I want to connect with a tablet to the Raspberry py to get AvNav on it. And also with a nodemcu (esp8266). Now, the AvNav wifi accespoint has an ip adress of 192.168.60.10. And I can connect with the tablet on it. So no problem at all anymore.

But the only thing is I want is change that hostadres (192.168.60.10) to 10.10.10.1

The most important reason is that I have this ipadress (10.10.10.1) hard coded in a nodemcu and it is hard to change that. I thought it is easy to change the ip adres on the Raspberry pi. But that looks to be wrong....

Op do 11 apr 2024 om 23:26 schreef Andreas Vogel @.***>:

For me it's still not really clear what you are trying to do. What do you mean with: the ap disappears and comes back al the time, connecting?

Do you talk about connecting to the AvNav wifi? Or about connecting with a browser? Would be really helpful to get a clear description about what exactly you are doing and what exactly does not work.

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2050581601, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YRAV2U7ICUVA35ZUN3Y435XFAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJQGU4DCNRQGE . You are receiving this because you authored the thread.Message ID: @.***>

free-x commented 5 months ago

does nodemcu get 10.x.x.x network assigned via DHCP? or is this also hardcoded?

Fietsenwiel commented 5 months ago

It is hard coded...

Op vr 12 apr 2024 om 08:56 schreef free-x @.***>:

does nodemcu get 10.x.x.x network assigned via DHCP? or is this also hardcoded?

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2051107345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YTOKVXIYHDB2UUW6ALY46AQDAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJRGEYDOMZUGU . You are receiving this because you authored the thread.Message ID: @.***>

wellenvogel commented 5 months ago

Ok, first part understood. But the second part is still open: Would be really helpfull to get a clear picture what you did and what EXACTLY did not work as exoected. "Does not connect" is not really a clear description.... So after you changed something it would always be good idea to try with a client where you have some analysis capabilities and check step by step: Wifi connect, IP address, routing, ping, browser And document the results. As said: it's more then just the ip. And again: using dhcp and bonjour is extremly simple even on a node mcu...

free-x commented 5 months ago

@Fietsenwiel what happens when you create an alias on wlan-ap?

sudo ifconfig wlan-ap:0 10.10.10.1 netmask 255.255.255.0 up
Fietsenwiel commented 5 months ago

This doesn't work, I don't have a wlan-ap.

But I am going to start from scratch by installing Bullseye, configuring the wlan like I need and then install avnav on it. I think this is the best way for me to go, then I know how the configuration works.

Thanks for your help anyway.

Op vr 12 apr 2024 om 09:52 schreef free-x @.***>:

@Fietsenwiel https://github.com/Fietsenwiel what happens when you create an alias on wlan-ap?

sudo ifconfig wlan-ap:0 10.10.10.1 netmask 255.255.255.0 up

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2051213000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YREA755OWC3YJZKJTDY46HFXAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJRGIYTGMBQGA . You are receiving this because you were mentioned.Message ID: @.***>

wellenvogel commented 5 months ago

So most probably in this case you do not want to install avnav-raspi - as this would set up the Ip as in the image.

Fietsenwiel commented 5 months ago

Yes, maybe that is the richt conclusies.

I want to make more charges like a vpn to my router so that I can acces the raspberry from home.

So then the avnav image is maybe not the best idea.

Thanks for your help!

Op vr 12 apr 2024 14:03 schreef Andreas Vogel @.***>:

So most probably in this case you do not want to install avnav-raspi - as this would set up the Ip as in the image.

— Reply to this email directly, view it on GitHub https://github.com/wellenvogel/avnav/issues/335#issuecomment-2051628632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ335YV5S67CHTMXQHZEEQTY47ESHAVCNFSM6AAAAABGAQACD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJRGYZDQNRTGI . You are receiving this because you were mentioned.Message ID: @.***>

free-x commented 5 months ago

i now see this: @.***:~ $ ifconfig wlan-ap: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.30.10 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::20f:55ff:fea8:9e0 prefixlen 64 scopeid 0x20 ether 00:0f:55:a8:09:e0 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 243 bytes 70167 (68.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

This doesn't work, I don't have a wlan-ap.

what now? did you or didn't you? is very confusing, and is too late anyway after your decision

BTW: which RPI do you have? is not clear to me anyway, how is it possible to initialize "wlan0" with our image... Internal WiFi is always assigned "wlan-ap"