Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Happy New Year!
Debian 11 bullseye
Attempting to configure /etc/network/interfaces with static ip address.
Results in "No valid active connections found!"
Code:
me@debian:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto wlp2s0
iface wlp2s0 inet static
address 192.168.5.2
netmask 255.255.252.0
gateway 192.168.4.1
dns-nameservers 209.16.64.2 209.16.64.1
Code:
me@debian:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether f4:8e:38:94:e2:6a brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether b0:c0:90:ac:cc:f1 brd ff:ff:ff:ff:ff:ff
inet 192.168.5.2/22 brd 192.168.7.255 scope global dynamic noprefixroute wlp2s0
valid_lft 13422sec preferred_lft 13422sec
inet6 fde5:7198:cd28:1:6abe:9fa0:ffca:57a/64 scope global temporary dynamic
valid_lft 603725sec preferred_lft 84868sec
inet6 fde5:7198:cd28:1:b2c0:90ff:feac:ccf1/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2591769sec preferred_lft 604569sec
inet6 fe80::b2c0:90ff:feac:ccf1/64 scope link noprefixroute
valid_lft forever preferred_lft forever
nmap -sL 192.168.5.2/22
Nmap scan report for 192.168.4.0
...
Nmap scan report for 192.168.7.255
Nmap done: 1024 IP addresses (0 hosts up) scanned in 0.02 second
So that will reach the gateway.
Code:
dns-nameservers 209.16.64.2 209.16.64.1
Code:
dig @209.16.64.2 google.com
; <<>> DiG 9.16.23 <<>> @209.16.64.2 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 6843
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: b088e45f09aa69adeea4ee0561d05e96dc1c99a817beb8ef (good)
;; QUESTION SECTION:
;google.com. IN A
;; Query time: 30 msec
;; SERVER: 209.16.64.2#53(209.16.64.2)
;; WHEN: Sat Jan 01 08:03:50 CST 2022
;; MSG SIZE rcvd: 67
dig @8.8.8.8 google.com
; <<>> DiG 9.16.23 <<>> @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21474
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 300 IN A 142.250.191.206
;; Query time: 26 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Jan 01 08:03:11 CST 2022
;; MSG SIZE rcvd: 55
Have you tried another DNS.
Can you ping by IP, and not URL?
Need more info.
Quote:
wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether b0:c0:90:ac:cc:f1 brd ff:ff:ff:ff:ff:ff
inet 192.168.5.2/22 brd 192.168.7.255 scope global dynamic noprefixroute wlp
Thanks for your help!
I will be more than happy to provide more info (assuming I understand what is required).
I have wifi connectivity now, because I erased this
me@debian:~$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether f4:8e:38:94:e2:6a brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether b0:c0:90:ac:cc:f1 brd ff:ff:ff:ff:ff:ff
inet 192.168.5.3/22 brd 192.168.7.255 scope global dynamic noprefixroute wlp2s0
valid_lft 13977sec preferred_lft 13977sec
inet6 fde5:7198:cd28:1:170a:680b:8806:5346/64 scope global temporary dynamic
valid_lft 604376sec preferred_lft 85519sec
inet6 fde5:7198:cd28:1:b2c0:90ff:feac:ccf1/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2591997sec preferred_lft 604797sec
inet6 fe80::b2c0:90ff:feac:ccf1/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Code:
me@debian:~$ ip route show
default via 192.168.4.1 dev wlp2s0 proto dhcp metric 600
192.168.4.0/22 dev wlp2s0 proto kernel scope link src 192.168.5.3 metric 600
The info provided from your host looks good. Was that when you had manually set the static address or dhcp?
What is the subnet mask on the router?
If the router netmask and the host netmask differ then it causes problems. If they are the same, then the network address should be 192.168.4.0/22 which gives you the usable subnet addresses 192.168.4.1 - 192.168.7.254 with broadcast at 192.168.7.255. That is indicated on the host info you posted, but needs to be verified to match on the router.
The info provided from your host looks good. Was that when you had manually set the static address or dhcp?
The code from post #6 is from my machine in stock form, without my code from post #3. I have not successfully set or changed anything (yet!).
Quote:
What is the subnet mask on the router?
I don't know how to find this.
Code:
me@debian:~$ sudo route -n
[sudo] password for me:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.4.1 0.0.0.0 UG 600 0 0 wlp2s0
192.168.4.0 0.0.0.0 255.255.252.0 U 600 0 0 wlp2s0
Quote:
...then the network address should be 192.168.4.0/22
Would that be my machine's ip address or the gateway?
Last edited by bayou self; 01-01-2022 at 02:31 PM.
Reason: added info
I tried nm-connection-editor, and I'm cautiously optimistic, as it is working for now. I entered the same data for address, netmask, gateway, and nameservers as in post #3 above. /etc/NetworkManager/system-connections has same. /etc/network/interfaces is unmodified.
Last edited by bayou self; 01-01-2022 at 05:05 PM.
Reason: clarity
@michaelk,
The IP address I chose was from one of the many found when running "ip a"...you are saying that's not good?
Q1: Is DHCP still active?
Q2: How do I find the range of addresses assigned by the DHCP server?
Q3: Can I assign the IP address any way I want, such as 192.168.anything.anything?
@michaelk,
The IP address I chose was from one of the many found when running "ip a"...you are saying that's not good?
Q1: Is DHCP still active?
Q2: How do I find the range of addresses assigned by the DHCP server?
Q3: Can I assign the IP address any way I want, such as 192.168.anything.anything?
I'd ask why you're wanting/needing to do this. If this is a laptop, you're just going to make it more difficult for yourself to take it places and use it, since the address you set for your home, most likely won't work in another location. Having a 'set' address for your system does make some things easier, though....I'd suggest going into your router settings, and set your device to 'keep' the DHCP address. It should tie to the MAC address on the system, and every time it comes up at home it'll get the same address. But in another location, it'll work normally.
The IP address I chose was from one of the many found when running "ip a"...you are saying that's not good?
The IP address found from the IP command was assigned by a DHCP server, either by your router, ISP or however you connect to the internet. If it isn't your own router then as soon as the DHCP lease expires that address goes back into the pool and could be assigned to other computers on the same network. If that happens there could be an address conflict which means that you and the other computer will not be able to access the network/internet.
Q1: The server is still active but your computer will not ask it for an address. Most DHCP servers now days will try to assign the same address to the same computer as long as the lease is still active.
Q2: If you do not own or have access to the router or device that runs DHCP server then it is not possible. If you do own the router then you can login to its web configuration page to check the range. If the latter is true then you might want to configure an address reservation versus static IP address which is essentially the same thing. This would be better if your PC is a laptop.
Q3: It depends. If the network/router is your own then basically yes but it must be within the same subnet as assigned by your router but again outside its DHCP server range. Otherwise no.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.