Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
01-26-2017, 08:42 PM
|
#16
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
Quote:
Originally Posted by wBB
In my opinion the problem may be on the router. I guess it's stopping my Linux device from gaining access to the internet.
It really could be DNS problem, as you said. But I still can't identify where exactly.
|
Why does it matter? Just put one of the public DNS servers in resolv.conf and be done.
Quote:
Originally Posted by wBB
The access from device to router, through the laptop, occurs correctly but is interrupted on the router.
|
Are you sure about that? Have you tried pinging 8.8.8.8 like I suggested?
|
|
|
01-26-2017, 09:32 PM
|
#17
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
michaelk
I forgot to ask you one thing: how do I find out what dynamic IP my Linux device is using? I have no monitor, no keyboard, no mouse, nothing ... I can only connect to the Linux device via Ethernet. How to discover its IP?
suicidaleggroll
When I disabled Linux DHCP to make IP fixed, the resolv.conf file was empty. I found it strange, so I reinstalled Linux and now I'm trying to do what "michaelk" said, before trying other things. But I encountered this problem I described above (Do you know the answer?)...
Answering your question, yes I'm sure. I tried pinging 8.8.8.8. Did not work...
|
|
|
01-26-2017, 09:53 PM
|
#18
|
Moderator
Registered: Aug 2002
Posts: 26,446
|
How did you originally configure the device with a static IP?
|
|
|
01-27-2017, 08:22 AM
|
#19
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
Quote:
Originally Posted by wBB
When I disabled Linux DHCP to make IP fixed, the resolv.conf file was empty. I found it strange, so I reinstalled Linux
|
It's not strange at all, that's perfectly normal. The DNS addresses are provided by the DHCP server, when you disable DHCP you need to specify them manually, along with the subnet mask and gateway address.
|
|
|
01-27-2017, 09:49 AM
|
#20
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
Quote:
michaelk
How did you originally configure the device with a static IP?
|
On Linux Debian Jessie, which I'm using, there is a connection manager called "connman". It was necessary to uninstall this service, then I configured my static ip, gateway ..., in "/ etc / network / interfaces" in eth0.
Quote:
suicidaleggroll
It's not strange at all, that's perfectly normal. The DNS addresses are provided by the DHCP server, when you disable DHCP you need to specify them manually, along with the subnet mask and gateway address.
|
OK, but I still can't solve a single problem I reported earlier: after setting a static IP on Linux and following the "Doug G" tutorial (which worked almost perfectly), I was able to get Linux to ping any external IP. But, Linux was no longer able to resolve the names, perhaps because the file "/etc/resolv.conf" was empty as I reported it. For example:
1) ping www.google.com, the reported error is "host is unreachable"
2) ping 8.8.8.8, It works!
So I have two options:
1- Keep the static IP and use the option indicated by "Doug G" to access the internet, as I was already doing, and try to solve the "naming problem" in Linux, which I think would be the most right;
2- Try to use the "michaelk" tutorial, as I'm doing right now, and use some tool in Windows to identify the dynamic IP of Linux in some way that I don't know yet.
|
|
|
01-27-2017, 09:55 AM
|
#21
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
TBH, I've only gone the "other" way with linux hosting the internet. Little more than enabling ip_forward and set a MASQUERADE rule for the internet bound interface going that way.
For windows, I would imagine enable ICS (in theory), set the address for the ethernet to linux on windows, probably not running a dhcp server (by default). Then set the linux address and set the windows address as the gateway. It would probably help if the linux half is on a different subnet. But tbh, never really tried that setup. I just instinctively know how to get wifi working in linux and find windows extremely frustrating to deal with. Plus I have enough spare low spec'd devices that can become linux wifi bridges in short notice. When I have issues, it's normally a flaky cable or an unreliable usb ethernet dongle.
|
|
|
01-27-2017, 10:09 AM
|
#22
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
Shadow_7
Thanks for your tips. But I've been able to access the internet with static IP on Linux on eth0 and cross cable connected to the laptop's ethernet. On the laptop there is also a wifi connection that gives internet access. So far so good.
For this solution I still have not been able to just make Linux resolve names as I said earlier. If you know how to solve this problem, I would be very grateful ...
For this reason I am also trying other alternatives as indicated by "michaelk".
|
|
|
01-27-2017, 10:22 AM
|
#23
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
Quote:
Originally Posted by wBB
OK, but I still can't solve a single problem I reported earlier: after setting a static IP on Linux and following the "Doug G" tutorial (which worked almost perfectly), I was able to get Linux to ping any external IP. But, Linux was no longer able to resolve the names, perhaps because the file "/etc/resolv.conf" was empty as I reported it. For example:
1) ping www.google.com, the reported error is "host is unreachable"
2) ping 8.8.8.8, It works!
|
So make it not empty
Lack of name resolution because of an empty resolv.conf is literally the simplest networking problem to fix. Open it up, and put in the address of a DNS server. It doesn't matter which one. You can check the laptop config to see what it's using and use that, you can use Google's DNS at "8.8.8.8" and "8.8.4.4", you can use OpenDNS at "208.67.222.222" and "208.67.220.220", etc. Just pick a couple and put them in the file:
Code:
nameserver 208.67.222.222
nameserver 208.67.220.220
Depending on how your network is set up (NetworkManager, /etc/network/interfaces/, etc) it may clear out again after a reboot, in which case you'll need to add your DNS servers in the same way you configured your static IP.
Last edited by suicidaleggroll; 01-27-2017 at 10:24 AM.
|
|
|
01-27-2017, 12:47 PM
|
#24
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
Good news!
I was trying to do what "michaelk" suggested and it was great as it worked fine 100% !! On Linux I can ping for IPs and ping for names (like ping www.google.com). Linux is accessing the internet without any problems. My Linux device is connected to the laptop via Ethernet-to-Ethernet (cross) cable and accessing the internet using the notebook's wifi.
By sharing the wifi connection as in the "michaelk" tutorial, Windows actually manages the laptop and Linux ethernet IPs. But considering I do not have any kind of access to Linux other than cable, I had to use the "Wireshark" sniffer software to find out which Linux IP it received and then connect with Windows SSH to Linux.
Now I'm going to try to do what the "suicidalogroll" suggested to see if it works, because I find it easier than having to be discovering the Linux IP every time I connect.
|
|
|
01-27-2017, 02:29 PM
|
#25
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
Very very good news !!! Problem totally solved ...
Debian, Jessie 8.6 distribution, has a connection manager called "connman". This manager has its own ways of operating with both static IP and dynamic IP. By default, the IP configuration is set dynamically. But in some cases, as in my case, it is necessary to make the IP static, but "connman" does not allow IP to be fixed in the ways known to most people, and it overrides the information when the Linux device is rebooted . In my case the device is a BeagleBone Black (BBB). To prevent this and make the IP static, the steps are:
1) Identify the eth0 name that "connman" manages. In my case there is a directory in "/var/lib/connman" that identifies eth0:
A) ls -la /var/lib/connman
It will be shown something like this:
drwxr-xr-x 3 root root 4096 Jan 27 18:42 .
drwxr-xr-x 33 root root 4096 Nov 6 15:28 ..
drwx------ 2 root root 4096 Jan 27 18:42 ethernet_9059af4beffc_cable
-rw------- 1 root root 284 Jan 27 18:42 settings
In my case the ethernet card eth0 is identified by the directory "ethernet_9059af4beffc_cable"
2) Knowing this directory, run a "connman" command to make the static IP:
connmanctl config ethernet_9059af4beffc_cable --ipv4 manual 192.168.137.2 255.255.255.0 192.168.137.1
Explaining the parts:
ethernet_9059af4beffc_cable => identification of my eth0 card
--ipv4 => identification of what will be configured, in this case the ipv4 protocol
192.168.137.2 => IP that I chose to configure the static IP of Linux
255.255.255.0 => subnetmask
192.168.137.1 => Gateway IP, which in my case is a Windows notebook
3) Configure the DNS servers:
connmanctl config ethernet_9059af4beffc_cable --nameservers 192.168.1.1 8.8.8.8
Explaining the parts:
--nameservers => identification of what will be configured, in this case the DNS servers
192.168.1.1 => IP of my router
8.8.8.8 => IP DNS Google
4) Edit the file "/ etc / network / interfaces"
NOTE: That was the first thing I did, before those others above. I did not get to test without doing this, but I believe that only items 1, 2 and 3 above are sufficient to solve the problem (fixed / static IP definitely). If it is not, then just edit the file "/ etc / network / interfaces", including at the end of the file the information below, adapting the numbers to your network:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.137.2 (IP that I chose)
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.137.1 (Ethernet IP of my Windows notebook)
dns-server 192.168.1.1 (my router)
5) Reboot.
Thank you all for your help. Well, that was a lot of work!
|
|
|
01-27-2017, 05:17 PM
|
#26
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
For DNS, my setup looks a bit like this for /etc/resolv.conf:
Code:
#
# /etc/resolv.conf
#
#search <yourdomain.tld>
#nameserver <ip>
# OpenDNS
nameserver 208.67.222.222
nameserver 208.67.220.220
# UnblockDNS
nameserver 167.88.120.178
nameserver 168.235.69.200
# google
nameserver 8.8.8.8
nameserver 8.8.4.4
# Verizon Level 3
nameserver 4.2.2.1
nameserver 4.2.2.6
# End of file
I keep a copy of it under /root/ so when odd dhcp things overwrite it, I can re-populate it with good specs. I sometimes need to shuffle the order of preference depending on which ddos is affecting things today, but mostly it just works.
Last edited by Shadow_7; 01-27-2017 at 05:21 PM.
|
|
|
01-27-2017, 06:09 PM
|
#27
|
Senior Member
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950
|
A couple of DNS nameservers is sufficient.
I just use one nameserver which is the address of my router,
which in turn has two nameservers specified in it.
Last edited by JeremyBoden; 01-27-2017 at 06:13 PM.
|
|
|
All times are GMT -5. The time now is 06:30 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|