Question on manually setting my DNS server address

Darc Sceptor

Member
Joined
Oct 2, 2024
Messages
74
Reaction score
14
Credits
845
In networking what I'm accustomed to is you pull up the addresses for your machine, you can set if the IP address is automatic or manual AND you can set if DNS is automatic or manual.

In my typical setup I have the IP address automatic and I manually set the DNS to 1.1.1.1 subnet 1.0.0.1.
Now also in that user interface, the DNS address is two edited displays so that I enter each of the 4 octets and it manages things under the cover.
But now I'm in Linux Mint and when it wants an address it is just a freaking text box!! It says separate additional numbers with a comma, but there is no help about how subnets are handled.

1) So thanks to lazy programming How do I enter an address and subnet in the DNS server box?
2) The lable for the field says "Additional DNS servers" - does this mean it adds my manual number to the automatic server numbers? The whole purpose of providing a manually defined DNS number is to avoid using the DNS machines used by your ISP.

Thanks in advance for your help.
 


1) So thanks to lazy programming How do I enter an address and subnet in the DNS server box?
...lazy programming different programming...
echo "nameserver 1.0.0.1" > /etc/resolv.conf
That said, Network Manager does break this (rewrites it), so you may want to edit /etc/network/interfaces and add the following:
Code:
auto <your interface, eg eth0, wlp6S1>   # Bring the interface up automatically
    iface <your interface> inet dhcp           # DHCP as you wanted
    gateway (your router address, eg: 192.168.0.1>   # It's optional, but I err on the side of caution
    dns-namservers 1.1.1.1 1.0.0.1            # IIRC, may have been a comma

Though you should probably use Network Manager itself as it doesn't always respect the interfaces file...
2) The lable for the field says "Additional DNS servers" - does this mean it adds my manual number to the automatic server numbers? The whole purpose of providing a manually defined DNS number is to avoid using the DNS machines used by your ISP.
IIRC, this is an override. so you enter the numbers in comma-separated line: 1.1.1.1, 1.0.0.1
You can always check: cat /etc/resolv.conf. If only your DNS is listed there, it's the only one you'll use. You may need to restart Network Manager, systemctl restart NetworkManager (should be named network-manager idiomatically, I know, but still).

So, pretty straightforward. Not laziness, just different approach... though not too different than Windows via GUI. As you use Linux more, you'll not just parrot learn -- we all have to just "do it like this" initially -- you'll start to gain intuition on solving problems, and at that point you'll realize why some users find Linux easier.
 
Last edited:
So, pretty straightforward. Not laziness, just different approach... though not too different than Windows via GUI. As you use Linux more, you'll not just parrot learn -- we all have to just "do it like this" initially -- you'll start to gain intuition on solving problems, and at that point you'll realize why some users find Linux easier.
Oh, ab-so-lutely. Couldn't have put it better myself.

Windows puts up a high steel fence between the user and the system. Linux not only lets you dive into the system and re-tighten the loose nuts'n'bolts, it'll hand you the necessary tools for the job at hand.....AND even help you to navigate to where the problem lies.

It's not only easier.....it just IS a "better", and more intuitive way of doing things.


Mike. :D
 
You may need to restart Network Manager, systemctl restart NetworkManager
on a system that does not use systemd like Devuan or Expirion that uses sysvinit instead that command would be
sudo service network-manager restart
 
/etc/resolv.conf should be a symlink that points to ../run/resolvconf/resolv.conf. I use /etc/network/interfaces to specify my dns-nameservers as specified in interfaces(5). I use ifupdown instead of Network Manager.

Signed,

Matthew Campbell
 
As a longtime system developer (over 30 years programming everything from complex online systems to code that flies a top secret Air Force jet) here is why I said it is lazy programming:

It takes 2 seconds to just throw in a textbox and hope people enter data correctly.
It takes time and a bit of artistry to give the user an edited input with 8 textboxes marked numeric entry only and visually presented in two rows with a "." between each octet. From that standpoint just throwing out one textbox is damn lazy programming NOT just "different" programming.
 
@Fanboi I am taking the approach to learn as I go and not just parrot what is being given to me to do. When trying to get my share writable I was given about 5 commands to run. I looked up each command so that I knew what was being done (though not always discovering why it was being done)
 
As a longtime system developer (over 30 years programming everything from complex online systems to code that flies a top secret Air Force jet) here is why I said it is lazy programming:

It takes 2 seconds to just throw in a textbox and hope people enter data correctly.
It takes time and a bit of artistry to give the user an edited input with 8 textboxes marked numeric entry only and visually presented in two rows with a "." between each octet. From that standpoint just throwing out one textbox is damn lazy programming NOT just "different" programming.
I totally agree. Never trust user input. A good program must always presume that the user is trying to trick the program. User input must always be checked and thoroughly sanitized. Good code will make an effort. Sloppy and lazy code just doesn't care. Anything worth doing is worth doing right.

Signed,

Matthew Campbell
 
I totally agree. Never trust user input. A good program must always presume that the user is trying to trick the program. User input must always be checked and thoroughly sanitized. Good code will make an effort.
Lol, you remind me of Petzold's programming book, where the author says how a programmer during development of a scrollbar must assume a user will try to rapidly scroll it back and forth in order to "bring the program down to its knees", and so you as developer need to implement scrolling only when mouse is below certain speed haha.
 
Oh, ab-so-lutely. Couldn't have put it better myself.

Windows puts up a high steel fence between the user and the system. Linux not only lets you dive into the system and re-tighten the loose nuts'n'bolts, it'll hand you the necessary tools for the job at hand.....AND even help you to navigate to where the problem lies.

It's not only easier.....it just IS a "better", and more intuitive way of doing things.


Mike. :D
Or.....putting it another way.....Linux lets the users quickly and efficiently hang themselves with the stuff the code lets into the system without ensuring it is correct. Which is why I refused to try and read the mind of the idiot that coded the IP screen with just a textbox. Using just a textbox without directions on how to enter an IP address and a subnet does not let ANYONE tighten the loos nuts'n'bolts but it does let the user completely remove all bolts all nuts and watch everything fall to the ground.

And I found the other day that Linux is very fragile compared to Windows. In Windows if a drive is there for session A and not there for session B then you just get your system without it. If you try to access it you get a message in the UI and have to figure out why the drive isn't there. With Linux if you mounted a drive and it isn't there in Session B Linux cries like a little baby and instead of giving you the UI you get a terminal window and the user has to guess what the hell caused me to get here?
 
Lol, you remind me of Petzold's programming book, where the author says how a programmer during development of a scrollbar must assume a user will try to rapidly scroll it back and forth in order to "bring the program down to its knees", and so you as developer need to implement scrolling only when mouse is below certain speed haha.
What decade was that stupid book written? I've programmed for 30+ years and was never concerned about a mouse when I used a listbox with integrated scrollbar.
 
What decade was that stupid book written? I've programmed for 30+ years and was never concerned about a mouse when I used a listbox with integrated scrollbar.
The book is from 1998 and is considered the bible for Windows programming because it's the only one that teaches Windows API's so good, and no modern alternative exists.

If you hold scrollbar with a mouse and rapidly move it back and forth this could crash the program if scrolling involves scrolling a lot of text or graphics, also because back then computer resources ware so low and such scenario was more likely, he was talking from his experience which predates 1998.
 
As a longtime system developer (over 30 years programming everything from complex online systems to code that flies a top secret Air Force jet) here is why I said it is lazy programming:

It takes 2 seconds to just throw in a textbox and hope people enter data correctly.
I would say you can either file a bug report about it to the Linux Mint team or create a feature request. And that you join the Linux Mint team, I'm sure you would a good addition given your experience. That way you will also have the chance to add some new knowledge to the opensource community by sharing those secrets, so opensource has a chance to improve from your experience.
 
Last edited:
I would say you can either file a bug report about it to the Linux Mint team or create a feature request.
And that you join the Linux Mint team
 
Last edited:
The book is from 1998 and is considered the bible for Windows programming because it's the only one that teaches Windows API's so good, and no modern alternative exists.

If you hold scrollbar with a mouse and rapidly move it back and forth this could crash the program if scrolling involves scrolling a lot of text or graphics, also because back then computer resources ware so low and such scenario was more likely, he was talking from his experience which predates 1998.
Ahh I think it was around 2001 that I moved from mainframe (only assembler language for me) to Windows development but I never read that book. And computers today can either handle the process or it lags the user.
 
I would say you can either file a bug report about it to the Linux Mint team or create a feature request. And that you join the Linux Mint team, I'm sure you would a good addition given your experience. That way you will also have the chance to add some new knowledge to the opensource community by sharing those secrets, so opensource has a chance to improve from your experience.
Well, thank you for that compliment. Once I get my dev machine back I need to get moving on writing my game. But I will look into what I need to do to program Linux and go from there. I have some C/C++ background but that isn't my first language.
 
@Fanboi I am taking the approach to learn as I go and not just parrot what is being given to me to do. When trying to get my share writable I was given about 5 commands to run. I looked up each command so that I knew what was being done (though not always discovering why it was being done)
Glad you're taking the initiative. Just to clarify (because reading the tone made me re-read how I phased my own post), I didn't mean parroting what was given to you, I meant more holistically on what's considered right/wrong in terms of how things are done!


As a longtime system developer (over 30 years programming everything from complex online systems to code that flies a top secret Air Force jet) here is why I said it is lazy programming:

It takes 2 seconds to just throw in a textbox and hope people enter data correctly.
It takes time and a bit of artistry to give the user an edited input with 8 textboxes marked numeric entry only and visually presented in two rows with a "." between each octet. From that standpoint just throwing out one textbox is damn lazy programming NOT just "different" programming.
Okay, I'm going to have to offer a differing opinion. I fully acknowledge the thinking behind your approach, I'm merely offering another POV:
Firstly, I agree, the "don't trust user-input" tenet holds very true. 100%. Never, ever, ever, ever, ever trust the user input ;)
However I disagree with trying to enforce a behavior (in this case) and this approach is also impractical. The more reasonable approach is sanity-checking input instead of trying to enforce it (sanity-checking should always be done). We handle input ourselves so we become responsible. It also allows us to make changes to the code more easily in the future as things change, without having to alter those input mechanisms. Let's take the text box example: Your boxes described only account for IPv4 format.
But the biggest issue is this: What if the user wanted to add an exhaustive DNS list? No GUI is really built for that in the first place (and none could be without becoming overwhelmingly unusable). So it's cleaner and simpler to just have a list. And the UI's fairly intuitive, I mean if you hover the mouse over the input field, it tells you "...separated with a comma..."
Anyways, just my opinion. There's no "right" and "wrong" (within reason), just different approaches which is why it's just not very kind to call other devs lazy when it may be they actually thought this through during the design phase.

Disclaimer: I'm not looking to start a debate, just pointing out that just because I cannot see why someone makes a certain design choice, I should not automatically assume they're <insert negative comment>, I should put forth my case for change and then we can discuss the pros and cons.
 
Disclaimer: I'm not looking to start a debate
Fully understood. I enjoy good conversation, unlike many nowadays that take a response to their view as an attack I take it as a chance to explore other viewpoints.

So here is an alternate point of view:
As a designer of an interface the job is to look to the future. What do we have now? Almost no IPV4 and tons of IPV6 available. The known need for multiple DNS servers for redundancy, And a possible mix of IPV4 and IPV6 addresses. Also a quick google reveals the Google DNS IPV6 servers. So what does the designer do? Just throw up a fracking textbox without any hint as to how to enter the data? NO.

1) we need many of slightly different formats but still 4 values.
2) we need entry of them but validation based on the type of data entered
3) a format the user can easily understand through intuitive interfacing

Result:
The text box is thrown the hell out
A listbox is the replacement. This allows for a display of a list of values that have been defined manually or automatically. Beneath the listbox are buttons to support Add Delete Edit. Delete is simple, choose a value in the listbox and hit the button. Voila, no more DNS entry.
A window for those actions that has a checkbox on top (IPV4? IPV6?)
The window displays either two __ . __ . __ . __
OR one __ : :::::_:____
The design assumes the first IPV6 value is the subnet (/48 or /64).
The design allows entry of : to indicate the repeating all 0 entry.
The user now knows what is expected for input without having to go to a forum asking what the hell they want in this entry form.

Personally speaking I would hate to be the programmer asked to support the IPV4 rules in addition to the IPV6 rules in only a textbox. Too great a potential for spaghetti code that is unsupportable. On the other hand in this design the checkbox defines what set of rules to apply to the entry.

Thank you for the opposing view. Are you a linux programmer?
 
Last edited:
Fully understood. I enjoy good conversation, unlike many nowadays that take a response to their view as an attack I take it as a chance to explore other viewpoints.
100% mate!

Result:
The text box is thrown the hell out
A listbox is the replacement. This allows for a display of a list of values that have been defined manually or automatically. Beneath the listbox are buttons to support Add Delete Edit. Delete is simple, choose a value in the listbox and hit the button. Voila, no more DNS entry.
Now that is a good plan as it reminds me of when I used to torrent linux ISOs (yeah, before servers could handle the strain of direct downloads, lol), my torrent client had that same mechanic adding trackers. It's very user-friendly. However I like to keep things simple. I'd suggest the text box stay and be placed below the list box. Now everyone's happy...

Quick <digression>:
Personally speaking I would hate to be the programmer asked to support the IPV4 rules in addition to the IPV6 rules in only a textbox. Too great a potential for spaghetti code that is unsupportable.
I don't see potential for "spaghetti" code TBH. I think you're misusing the term -- blame Reddit. The term originated as a descriptor of bad flow-control. Over the years lots of people have misused it to mean anything messy, so it's like the "whoever/whomever" thing...ish. Anyway, using a single input is actually quite easy (and the below code could be shortened, but it's illustrative):
Python:
# Yes, I probs did some "bad" practices, but it works and is future proof. Refractoring is SEP

# Okay kids, pretend this is a text box...
# I did convert input to a whitespace-free list on-the-fly to kick things off more smoothly.
dnses = [dns.strip() for dns in input("Enter a DNS list, comman-separated: ").split(',')]

ipv4 = []
ipv6 = []
ipvX = []
for dns in dnses:
	# ------ IPv4
	if dns.count('.') == 3:
		octets = dns.split('.')
		valid = True

		for octet in octets:
			if not (octet.isdigit() and 0 <= int(octet) <= 255):
				valid = False
				break
		
		if valid:
			ipv4.append(dns)
		else:
			ipvX.append(dns)
		
	# ----- IPv6
	elif dns.count(':') == 7:
		hextets = dns.split(':')
		valid = True

		# And then he got lazy an h4xed it
		for hextet in hextets:
			if hextet == '':
				continue
			try:
				hexval = int(hextet, 16)
			except ValueError:
				valid = False
				break

		if valid:
			ipv6.append(dns)
		else:
			ipvX.append(dns)
	
	# ----- Future possible formats
	# elif blah blah

	else:
		ipvX.append(dns)

print(f"\n----------- Results -----------\n")
print(f"IPv4 DNS list: {ipv4}\n")
print(f"IPv6 DNS list: {ipv6}\n")
print(f"\nBotched: {ipvX}\n\n")
PS: I'm sure any Python programmers on this forum will have 99 reasons to pick at my code... I have 99 reasons to pick at Python...
</digression>

...So, by all means, make a suggestion on mailing list, git, IRC channel, or whatever, for Network Manager. Seriously, that's how you get features you want: 1) Ask politely and 2) offer assistance. Devs are generally not asshats, so if they disagree with you, they'll say so politely, and they won't ever dismiss the idea moving forwards. Thunar recently started placing "Places" on the top of the left pane and "Devices" below. This was after a lengthy period of debate over it (7 years IIRC). So a rejection won't mean "it's never gonna happen".

Thank you for the opposing view. Are you a linux programmer?
Likewise, thanks for yours... No, I'm not a linux programmer (I'm not a kernel developer), but I've been coding for about 27-28 years. I discovered QBasic on my MSDOS 286 and that threw me down a rabbit hole. I've never done it as a career. I've worked on a few projects here and there for company in-house stuff, never really done anything big though. Probably the only project you may have heard of was Ponycraft: Tainted Skies and that got cancelled. I've released a game of my own into the wilds (though the site's dead, should probs upload it to archive.org) along with some utilitarian stuff which may or may not be gone. My only real 5 minutes of fame was a coding contest I won back in 2011-12 (somewhere around there). I haven't coded much since then, aside from a password manager I wrote for myself out of necessity for both Desktop and Mobile (weeell, an aarch64 binary run in Termux -- but shortest distance between two points). I only started getting back into it recently (I don't consider shell scripts programming, but if you do then I guess I only took about a two years break).
 
So you said that the code had room for "other formats" but in the case of IP addresses there will only be IPV4 and IPV6. The first is nearly used up. The second has 2^128 combinations of numbers. We will be dead and our kids will be dead by the time there is another format.

Your code is possible but there is no validation of the data entered and you are missing determination if the subnet has been provided or not. You treat both types equally but the IPV4 is a 32 bit value with a second 32 bit value for the subnet while the IPV6 is128 bit number. Also if it is an IPV6 they have a rule where :: indicates multiple entries of 0000. And THAT's the rub with just a textbox. Both the address and subnet look the same but have different purposes. Also your IPV6 code doesn't validate that the correct subnet was entered for the IPV6 number. (the first sextuplet is the subnet)

So you may have missed it in this thread but I have been a professional computer scientist for over 30 years. I've designed systems, designed a banks branch software, and spent 5 years writing code for the Department of Defense. I also worked on a new operating system and wrote a compiler. So I have just a little bit of background in coding and design. :)
 

Members online


Top