Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Change configuration for static IP
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Fri Apr 18, 2014 8:18 pm    Post subject: Change configuration for static IP Reply with quote

Hi, ALL,
I don't know whether this belongs to here or in Networking, but I'd like to start somewhere...

I had a nicely configured working Gentoo install on the DHCP. Now, I wanted to install Samba on that machine.
So, I did install and configured Samba.

Since I wanted to connect to this machine from Windows XP I did change my router configuration to assign a static IP address to this machine.

Now in order to work with static IP I changed the configuration according to the Handbook adding the address to the /etc/conf.d/net file.

In the Samba configuration I bound Samba to use wlan0 inteface.

Now the problem.

I rebooted the machine and after that strange things started to happen.

After re-boot I issued "startx" and then nothing happened. X didn't want to start. No error messages, no nothing. It was just sitting in the CLI waiting for something.

I hit Ctrl+C got back to the shell prompt. Trying to investigate I checked and to my surprise there was no net.wlan0 file for the wireless interface.

So I made one, added it to the "default" runlevel and rebooted.

Now, the boot went thru, but in the end there was no shell prompt. The boot stopped at the line:

"This is <host_name>"

without going to the shell prompt.

So, now I need someone's help.

What I did wrong and how do I fix it?

I can probably unmerge Samba for now to make the static IP going first, and then continue with Samba installation.

Thank you.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Fri Apr 18, 2014 9:12 pm    Post subject: Reply with quote

Given the very limited information, my guess would be that DHCP configures something else that is important to you. With DHCP disabled, that something is not configured and so problems arise. Why did you switch off DHCP if it was working? DHCP with reservations is almost always superior to static configurations maintained separately for every system.
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Fri Apr 18, 2014 9:34 pm    Post subject: Reply with quote

Hi,
So now I have 2 questions.

1. I reconfigured my router to use static IP for my Gentoo machine and for Windows XP machine. Now are you saying that I could just use DHCP even in this case?
2. How do I restore my system to the working condition on the wireless network?

The funny thing is that it is working on eth0 (wired connection).

Also if you need anything else, just ask. I didn't know what to post.

Thank you.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Apr 18, 2014 10:45 pm    Post subject: Reply with quote

ONEEYEMAN wrote:
Also if you need anything else, just ask. I didn't know what to post.

ONEEYEMAN ... generally its best to post the configuration used :) ... ie, /etc/conf.d/net. Anyhow, when you say "configured the router to assign static addresses" I assume this is for both the MAC address of eth0 and wlan0? Besides the issue with '<host_name>' (and X11 not starting) it sounds as though its only configured to assign the address for one interface. As for DHCP or static address, it shouldn't matter, the router having been configured to provide that address to the machine with that specific MAC it should do so if using dhcp ... or ... given that address is reserved, it can be self-assigned.

/etc/conf.d/net (self-assigned ... requires sys-apps/iproute2)
Code:
modules_eth0="!plug iproute2"
config_eth0="192.168.0.2/24"
routes_eth0="default via 192.168.0.1"
dns_servers_eth0="192.168.0.1"
enable_ipv6_eth0="false"

modules_wlan0="!plug wpa_supplicant iproute2"
wpa_supplicant_wlan0="-Dnl80211 -qq"
wpa_timeout_wlan0=15
config_wlan0="192.168.0.3/24"
routes_wlan0="default via 192.168.0.1"
dns_servers_wlan0="192.168.0.1"
enable_ipv6_wlan0="false"

However, as I said, DHCP could be used ... assuming the router is configured correctly for both eth0 and wlan0 interfaces.

ONEEYEMAN wrote:
"This is <host_name>"

check that /etc/conf.d/hostname has your hostname, and that /etc/hosts has your hostname assigned to localhost, eg:

/etc/conf.d/hostname
Code:
hostname="oneeye"

/etc/hosts
Code:
127.0.0.1  oneeye.lan  oneeye  localhost

... I suspect this is the reason that startx is hanging ... though I'm a little confused as why this might have worked when using dhcp.

best ... khay
Back to top
View user's profile Send private message
ONEEYEMAN
Advocate
Advocate


Joined: 01 Mar 2005
Posts: 3610

PostPosted: Fri Apr 18, 2014 11:27 pm    Post subject: Reply with quote

Hi,
I temporary removed Samba, changed /etc/conf.d/net to use DHCP and corrected /etc/hosts.
Now I rebooted and everything works.

I am going to finish my project and then will try Samba.

Thank you.

P.S.: If you are familiar with Samba and how to make it work over the wireless network I'm all ears.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Sat Apr 19, 2014 12:38 am    Post subject: Reply with quote

Some people misuse "static IP" to include both the idea that there is no central management and the idea that addresses are centrally managed, but reserved so that the same result occurs every time. I assumed from context that the OP configured for the former, but the latter is a better arrangement, since it permits the DHCP server to set routes, advertise NTP, etc.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sat Apr 19, 2014 12:48 am    Post subject: Reply with quote

You shouldn't assign your hostname to the localhost but to an network one.

So do :
127.0.0.1 localhost
192.168.0.2 oneeye

localhost is special and bypass rules made on other interface. You should never assign any host to loopback except to explicitly create bogus traffic (like redirecting some url to localhost in order to ignore the url as done with rough publicity filtering).
Multicasting and brodcasting from localhost should be drop, so oneeye will be mute and services using it will not work.
So ping oneeye should resolve to 192.168.0.2 or 3... hostname -i should return your eth or lan interface ip but not 127.0.0.1

There might be other reasons i'm not aware of.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Apr 19, 2014 3:49 am    Post subject: Reply with quote

krinn wrote:
You shouldn't assign your hostname to the localhost but to an network one.

krinn ... this is a *local* definition ... and it is exactly the method provided in Chapter 8, Code Listing 2.10 of the Gentoo Handbook.

krinn wrote:
localhost is special and bypass rules made on other interface. You should never assign any host to loopback except to explicitly create bogus traffic (like redirecting some url to localhost in order to ignore the url as done with rough publicity filtering).

I don't see how its special, and such a definition effects nothing other than the localhost, and that is precisely the network that local resolves to.

krinn wrote:
Multicasting and brodcasting from localhost should be drop, so oneeye will be mute and services using it will not work.

Not sure what you mean here ...

krinn wrote:
So ping oneeye should resolve to 192.168.0.2 or 3... hostname -i should return your eth or lan interface ip but not 127.0.0.1

As far as this machine is concerned 127.0.0.1 and 192.168.0.2 are the same host and unless there is some strange circumstance that I would need to treat what as local as somehow remote then I don't see why the external IP has any baring on what is essencially local. If we are binding to an interface via a hostname then yes, some care should be taken, but as most services bind to an IP or 0.0.0.0:* and not hostname it shouldn't cause issues.

best ... khay
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sat Apr 19, 2014 12:10 pm    Post subject: Reply with quote

khayyam wrote:
If we are binding to an interface via a hostname then yes, some care should be taken, but as most services bind to an IP or 0.0.0.0:* and not hostname it shouldn't cause issues.

Better have just a resolution of oneeyes to a valid interface instead of loopback, even if it doesn't do any harm.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Apr 19, 2014 1:09 pm    Post subject: Reply with quote

krinn wrote:
khayyam wrote:
If we are binding to an interface via a hostname then yes, some care should be taken, but as most services bind to an IP or 0.0.0.0:* and not hostname it shouldn't cause issues.

Better have just a resolution of oneeyes to a valid interface instead of loopback, even if it doesn't do any harm.

krinn ... but loopback is valid *locally*, its not like 127.0.0.1 and 192.168.0.2 are different hosts, they are the same from the hosts perspective. Besides, how should /etc/hosts be defined for hosts that recieve their IP dynamically, should there be no resolution (locally) of 'oneeyes'?

best ... khay
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sat Apr 19, 2014 9:06 pm    Post subject: Reply with quote

This is OK
Code:
127.0.0.1 localhost oneeye
192.168.0.2 oneeye

This is not
Code:
127.0.0.1 oneeye
192.168.0.2 oneeye

_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum