LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2018, 02:05 PM   #1
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 176

Rep: Reputation: Disabled
Arrow Can anyone help me remove network-manager and dnsmasq from Ubuntu 16.04


I want to be able to configure my network manually and not have to rely on GUI programs, but I am afraid to move forward before I have all my ducks in a row. I have been researching this so I know I need to provide some info to get things going. I am connected to a router which is bridged to a router/modem from my ISP, but I deactivated it's DHCP server so it's basically a 4 port modem. Here is some info that I know is required, if anything else just ask. This is a wired connection, however it's not eth0, rather it's ( enx0023576c7619 ) a USB3.1 type-c adapter to ethernet cable, my laptop does not have a ethernet port.

My Ifconfig :
Code:
ifconfig
enx0023576c7619 Link encap:Ethernet  HWaddr [ x ]
          inet addr:192.168.1.14  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::[ x ] Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 

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
My /etc/resolv.conf
Code:
 cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
My /etc/network/interfaces
Code:
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

iface enx0023576c7619 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        network 192.168.1.14
        broadcast 192.168.1.255
        gateway 192.168.1.1
        dns-nameservers 1.1.1.1 1.0.0.1
My goal is to set up a static IP 192.168.1.14 with full networking capabilities from boot-up, automated so I don't have to issue commands every time I restart the computer. My routers DNS is also set to 1.1.1.1 1.0.0.1.

Last edited by tuxthegreat; 11-13-2018 at 08:59 PM.
 
Old 11-13-2018, 07:20 PM   #2
agillator
Member
 
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 419

Rep: Reputation: Disabled
What distribution are you using? [Edit: Oops, I see that you already said that in the topic - sorry.] Assuming it is recent and uses systemd, you can go through all the gyrations and still have things screwed up. I would suggest doing things the easy way that works, then fine tuning if you desire. And I will also mention that using a GUI is still doing things manually. I think you mean you would rather use the command line interface (CLI, i.e. terminal) rather than a GUI because the CLI normally gives you more conrol (but not always by any means).

Anyway, assuming your reason is that you want to control rather than actually have a problem with network manager or dnsmasq I would suggest the following. Note that these instructions are based in ubuntu. If you are using something else you may need to modify them. First, enable DHCP on one of your routers. Then set it to give your laptop a static address on the LAN. Most routers you control through a special web page on the router itself. You will need to provide the MAC address of your ethernet card or dongle (the hardware address from ifconfig which should be of the form xx:xx:xx:xx:xx:xx). Then remove resolv.conf from systemd control. Do that by determining what dns servers you want to use. You can use up to three. If there is one on you LAN it may be set up to forward external address to another server. Once you know the ips of the servers you want to use, move /etc/resolv.conf so the system doesn't recognize it (resolv.conf.xxx or something). Then create a new /etc/resolv.conf with your nameservers, e.g.
nameserver 123.123.123.123
nameserver 1.1.1.1
or whatever you want, one nameserver per line, 3 max. When that is done, change the attributes of the file with
sudo chattr -e /etc/resolv.conf
sudo chattr -i /etc/resolv.conf
That locks it so systemd will not modify or replace it and puts you in absolute control.

This is the easy way and works with the existing system rather than against it by trying to reinvent the wheel, so to speak.

Last edited by agillator; 11-13-2018 at 07:21 PM.
 
Old 11-13-2018, 07:40 PM   #3
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 176

Original Poster
Rep: Reputation: Disabled
Code:
 agillator
>>>>

Anyway, assuming your reason is that you want to control rather than actually have a problem with network manager or dnsmasq I would suggest the following. Note that these instructions are based in ubuntu. If you are using something else you may need to modify them.

Code:
First, enable DHCP on one of your routers. Then set it to give your laptop a static address on the LAN. Most routers you control through a special web page on the router itself.
- I already have DHCP enabled on my Linksys router, and I already configured the router to use 1.1.1.1 and 1.0.0.1 as my DNS, so that part is done.

Code:
You will need to provide the MAC address of your ethernet card or dongle (the hardware address from ifconfig which should be of the form xx:xx:xx:xx:xx:xx). Then remove resolv.conf from systemd control.
It's a laptop, it has an internal network card and I posted my ifconfig in my post, however I do not understand how to remove resolv.conf from systemd control. If we can get that part done, we could move onto the next parts.

Last edited by tuxthegreat; 11-13-2018 at 08:18 PM.
 
Old 11-13-2018, 10:35 PM   #4
agillator
Member
 
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 419

Rep: Reputation: Disabled
OK. We obviously have some educating to do here.

You are going to use your router to provide you with a static ip address, NOT DNS (Domain name server) addresses. Totally different. Understand what happens when you start your computer. Your Internet Service Provider (ISP) as part of the modem/router logon provides certain information to it, specifically an ip address which it will use and possible some DNS addresses which you may or may not use. Your router then provides your computer with a different address on a different network and acts as a bridge between the two. Now if you don't have a router then your computer uses the ISP information directly but you have a router so your computer and any other computers which may be connected to it are on this other network, a Local Area Network, or LAN. This is why multiple computers can use one internet connection. Now, the router has a list of addresses it will provide computers on the LAN, normally from one of the private network ranges 10.x.x.x, 192.168.x.x, 172.16-31.x.x. In doing this the router checks a list of hardware identities and if it matches then it knows the specific address to issue. That is why if you connect to your router through and ethernet card and later through a different ethernet card or a wifi connection you will get different ips, not the static one you expect unless you have already told the router what you want to do. This is why you need to find out how to log on to your router (read the instructions for that router) and then go to a fixed leases section of it to give it that information. To do that, you first have to get the MAC or hardware address of the devce you will use to connect (totally different from an ip address). You can usually get that from ifconfig. Look for the device you are actually connecting through and look for an entry of the form xx:xx:xx:xx:xx:xx, six hexadecimal numbers separated by colons. Tell your router to give that MAC the ip address you want, probably from the 192.168.x.x range, for example 192.168.1.21. If you can connect through another device make an entry for it also. I would recommend a different ip, using the same could cause a problem down the road. You might use 192.168.1.21 and 192.168.1.22 for example for two devices.

Now, resolv.conf. I assume you have some facility with the command line, so open a terminal. To begin with get the current resolv.conf out of the way, but don't delete it so you can restore it later if you want to. The command is
Code:
 sudo mv /etc/resolv.conf /etc/resolv.conf.xxx
Now, assuming you have the specific DNS server(s) you want to use:
Code:
 sudo cat > /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
and press CTL-C. Of course you can use your favorite text editor instead of cat if you wish, and use whatever DNS servers you wish. The samples I gave are for the google servers which seem to be pretty popular and always up. You have to have one, can have as many three. I used two for illustration. Once you have created the new resolv.conf,
Code:
sudo chattr -e /etc/resolv.conf
sudo chattr +i /etc/resolv.conf
resolv.conf is now locked so it cannot be changed, period. To do anything with it later, including editing it, you must unlock it:
Code:
sudo chattr -i /etc/resolv.conf
The way the list of name servers works, the system will first contact the first server. If it does not respond or cannot find the address, the system will try the second and then the third if no success. That is why many people use three different, unconnected servers rather than all from google or something. You might try one from google, one from your isp and one from OpenDNS for example.

This keeps everything simple (relatively) and should keep you system working with you in control. Once you know it works and know what you are doing you can tinker with it a little bit at a time. For example you can turn off dnsmasq and you can use different network managers but I would not try yet. Wait until you have things working this way and then try ONE AT A TIME.

I hope I did not get too basic, I certainly had no intention of insulting, but your question and response indicated some confusion somewhere so I thought the best thing was to get very basic just in case.

Last edited by agillator; 11-13-2018 at 10:39 PM.
 
1 members found this post helpful.
  


Reply

Tags
dnsmasq, network-manager, ubuntu 16.04



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to remove unwanted wireless network in network manager? mshlinux Debian 2 06-25-2013 09:37 AM
Hey guys,How can i use dnsmasq to server more than one subnet?is there anyone know ? jack ma Linux - Newbie 2 07-06-2012 06:25 AM
setting up a private network, using dnsmasq, I have small problem lhorace Linux - Newbie 4 10-11-2010 08:10 AM
[SOLVED] How do I switch the network manager from YAST back to the default network manager? skykooler SUSE / openSUSE 7 03-09-2010 06:28 PM
DNSMASQ anyone? Help! JeffC1 Linux - Software 3 03-31-2009 10:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration