LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 01-26-2017, 07:42 PM   #16
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142

Quote:
Originally Posted by wBB View Post
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 View Post
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?
 
Old 01-26-2017, 08:32 PM   #17
wBB
LQ Newbie
 
Registered: Jan 2017
Posts: 25

Original Poster
Rep: Reputation: Disabled
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...
 
Old 01-26-2017, 08:53 PM   #18
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
How did you originally configure the device with a static IP?
 
Old 01-27-2017, 07:22 AM   #19
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by wBB View Post
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.
 
Old 01-27-2017, 08:49 AM   #20
wBB
LQ Newbie
 
Registered: Jan 2017
Posts: 25

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-27-2017, 08:55 AM   #21
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
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.
 
Old 01-27-2017, 09:09 AM   #22
wBB
LQ Newbie
 
Registered: Jan 2017
Posts: 25

Original Poster
Rep: Reputation: Disabled
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".
 
Old 01-27-2017, 09:22 AM   #23
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by wBB View Post
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 09:24 AM.
 
Old 01-27-2017, 11:47 AM   #24
wBB
LQ Newbie
 
Registered: Jan 2017
Posts: 25

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-27-2017, 01:29 PM   #25
wBB
LQ Newbie
 
Registered: Jan 2017
Posts: 25

Original Poster
Rep: Reputation: Disabled
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!
 
Old 01-27-2017, 04:17 PM   #26
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
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 04:21 PM.
 
Old 01-27-2017, 05:09 PM   #27
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
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 05:13 PM.
 
  


Reply



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
Slow internet connection on multiple linux distros but fast connection on windows Preston3050 Linux - Newbie 7 10-31-2013 12:21 AM
Slow internet connection on multiple linux distros but fast connection on windows Preston3050 Linux - Networking 1 10-29-2013 12:03 PM
Internet Connection Sharing from Windows XP to Linux Patchy Linux - Networking 2 09-21-2005 03:02 PM
Windows - linux internet connection beepee Linux - Networking 3 09-01-2005 04:35 PM
i can get internet connection in windows but in LINUX there is no connection ruzvay Linux - Networking 2 06-08-2004 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 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