LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-25-2019, 05:20 PM   #1
Nick-us
Member
 
Registered: Feb 2019
Distribution: Slackware64-Current
Posts: 65

Rep: Reputation: 8
Question Connect Internet (Simple Question) Beginner


I will try to explain as best I can my doubt.

1) I don't use NetworkManager nor have it installed.
2) Know before I don't configure networking on my slackware when I install it! I always skip this part in the installation.

I created a script that sets and sets the values I use. My script connects to the Internet, IP exchange, simple things.

Today in an initial installation, I realized that the Internet didn't work.
So I accessed my script and run it. But the way I want to use it was insisting on not working

In order not to mix Shell Script with my doubt, I will show the commands that I execute only

I run the command below to set up and connect my Internet.

Code:
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0 -D nl80211
ifconfig wlan0 192.168.1.10
route add default gw 192.168.1.1
But it did not work. So figuring it could be any mistake, I made it clean!
Code:
dhclient -r
killall wpa_supplicant
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0 -D nl80211
ifconfig wlan0 192.168.1.10
route add default gw 192.168.1.1
But it still didn't work.

What confuses me, is that if I do the way below, he assigning the IP automatically. It works!
Code:
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0 -D nl80211
dhclient wlan0
I want to understand what dhclient did differently, what it modified to make it work?

And because, just because I executed the command above, the previous commands that didn't work now work normally without problems.

I would like to know if dhclient has modified any files on my pc and which file to do this magic.
 
Old 08-25-2019, 06:05 PM   #2
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
For manual setup you'll need to add the nameserver in /etc/resolv.conf. If your nameserver (presumably your router) IP is 192.168.1.1, then add the following to /etc/resolv.conf:
Code:
nameserver 192.168.1.1
Your sequence of commands should have worked if only wlan0 was in use on your system. You could try the following sequences with either ifconfig&route or with the modern iproute2 - don't use both! Make sure your router accepts manual host setup for 192.168.1.10, you could reserve 192.168.1.10 - bind it to your wlan0 MAC.
- Connect:
Code:
# with the old ifconfig & route utilities
/sbin/ifconfig wlan0 up
# with the new iproute2 utilities
/usr/sbin/ip link set wlan0 up
# start wpa_supplicant
/usr/sbin/wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0 -D nl80211
# with the old ifconfig & route utilities
/sbin/ifconfig wlan0 192.168.1.10 netmask 255.255.255.0
/sbin/route add default gw 192.168.1.1 wlan0
# with the new iproute2 utilities
/usr/sbin/ip address add 192.168.1.10/24 dev wlan0
/usr/sbin/ip route add default via 192.168.1.1 dev wlan0
- Disconnect:
Code:
# kill wpa_supplicant
/bin/killall wpa_supplicant
# with the old ifconfig & route utilities
/sbin/ifconfig wlan0 down
/sbin/route del default gw 192.168.1.1 wlan0
# with the new iproute2 utilities
/usr/sbin/ip addr flush dev wlan0
/usr/sbin/ip link set wlan0 down
/usr/sbin/ip route del default via 192.168.1.1 dev wlan0

Last edited by abga; 08-25-2019 at 07:13 PM. Reason: typo + formatting
 
2 members found this post helpful.
Old 08-25-2019, 08:47 PM   #3
Nick-us
Member
 
Registered: Feb 2019
Distribution: Slackware64-Current
Posts: 65

Original Poster
Rep: Reputation: 8
Thumbs up Thanks this solves the problem

Quote:
Originally Posted by abga View Post
For manual setup you'll need to add the nameserver in /etc/resolv.conf. If your nameserver (presumably your router) IP is 192.168.1.1, then add the following to /etc/resolv.conf:
Code:
nameserver 192.168.1.1
Thanks for answering! I noticed that dhclient wlan0 fills in this file. which is why it later works
And what was missing in my initial command was exactly what you reported.
I deleted everything to test your solution, and it really worked! What I will have to study further about this file to understand it better.

Looking at past changes to this file I noticed
OLD FILE
Code:
domain oi.com.br
search oi.com.br
nameserver 192.168.1.1
VERY OLD FILE
Code:
domain bloi.com.br
search bloi.com.br
nameserver 192.168.1.1
If you can answer me what would domain and search in it?

I preferred to leave him only with:
Code:
nameserver 192.168.1.1
Quote:
You could try the following sequences with either ifconfig&route or with the modern iproute2 - don't use both! Make sure your router accepts manual host setup for 192.168.1.10, you could reserve 192.168.1.10 - bind it to your wlan0 MAC.
I'll study your command sequence, learning never hurts
 
Old 08-25-2019, 09:09 PM   #4
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
You could leave both search and domain out of your /etc/resolv.conf if you don't have a local DNS and don't need to resolve local LAN hosts.
I suggest to make use of man when learning about basic Linux stuff, for example, run:
Code:
man resolv.conf
The output would be identical to:
https://linux.die.net/man/5/resolv.conf

A little search on the Internet will give you many detailed explanations, like:
https://superuser.com/questions/5700...tion-option-do
https://unix.stackexchange.com/quest...tc-resolv-conf

As for the sequence of commands I suggested, those are pretty much the same as yours, just a little more "complete". Try to get used with the iproute2 commands, ifconfig & route are getting retired.
 
2 members found this post helpful.
  


Reply

Tags
dhclient, ifconfig, internet, network, wpa_supplicant



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
Simple Slackware vs simple Arch vs simple Frugalware punchy71 Linux - Distributions 2 08-28-2012 02:30 PM
Simple Question - needing a simple answer plz linuxnoob_sowhut Linux - Distributions 1 12-01-2010 03:54 AM
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 02:03 PM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 09:03 PM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 04:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:12 AM.

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