I have HP laptop with an external wifi Adapter as there is no Wifi adapter inbuild.
This is my ifconfig result
docker0 Link encap:Ethernet HWaddr 02:42:fc:cf:ad:7c
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eno1 Link encap:Ethernet HWaddr 10:e7:c6:7c:81:c3
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 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:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:6880 errors:0 dropped:0 overruns:0 frame:0
TX packets:6880 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:580042 (580.0 KB) TX bytes:580042 (580.0 KB)
virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 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:0 (0.0 B) TX bytes:0 (0.0 B)
wlx502b73e86298 Link encap:Ethernet HWaddr 50:2b:73:e8:62:98
inet addr:192.168.43.254 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::a85:c587:3653:359/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:53032 errors:0 dropped:0 overruns:0 frame:0
TX packets:45991 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:42520401 (42.5 MB) TX bytes:6912557 (6.9 MB)
I take my IP is 192.168.43.254 and wifi adapter is wlx502b73e86298
Now when I connect to another WIFI, my IP changes to
192.168.0.106
Can I keep some static IP lets say 192.168.0.10 and no matter whichever WIFI I am connected it should work fine?
I have tried following configuration in
sudo nano /etc/network/interfaces
auto wlx502b73e86298
iface wlx502b73e86298 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.4.4 8.8.8.8
And than run these commands
sudo ip addr flush wlx502b73e86298
sudo systemctl restart networking.service
Now if I do ifconfig I can see my IP as 192.168.0.10
but ping google.com doesn't work and I cant access the internet.
Why I need a static IP is because I have a few containers running in Docker and all are pointing to Host IP. If Host IP changes I have to change IP in each container.