View previous topic :: View next topic |
Author |
Message |
Gh0str1d3r Guru

Joined: 27 May 2008 Posts: 411
|
Posted: Mon May 17, 2010 2:10 pm Post subject: how to setup static ip? [solved] |
|
|
Hi,
I am fully failing in setting up my wired network interface to use static ip. My /etc/conf.d/net looks like
Code: | # cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#modules="dhcpcd"
ifplugd_eth0="134.34.143.182 netmask 255.255.255.1289"
routes_eth0="default via 134.34.143.129"
dns_servers_eth0="134.34.3.2 134.34.3.3"
# Prefer wpa_supplicant over wireless-tools
modules="wpa_supplicant"
# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet
wpa_supplicant_wlan1="-Dwext"
|
where I also tried ifconfig instead of ifplugd, with the same effect. The static ip I gave there is simply ignored, as well as the netmask and the gateway. The dns-servers in /etc/resolv.conf are overridden to empty.
here is the output of ifconfig after starting net.eth0 with the above given /etc/conf.d/net:
Code: | # ifconfig eth0
eth0 Protokoll:Ethernet Hardware Adresse 00:1e:33:24:9c:34
inet Adresse:134.34.143.182 Bcast:134.34.143.255 Maske:255.255.255.128
inet6 Adresse: fe80::21e:33ff:fe24:9c34/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3802 errors:424 dropped:0 overruns:0 frame:159
TX packets:2877 errors:0 dropped:0 overruns:0 carrier:1
Kollisionen:572 Sendewarteschlangenlänge:1000
RX bytes:1981594 (1.8 MiB) TX bytes:459558 (448.7 KiB)
Interrupt:30
|
Setting the correct values manually with
Code: | # ifconfig eth0 134.34.143.182 netmask 255.255.255.128 up |
works fine, but its annoying to setup the network by hand every reboot. Can it be so difficult to correctly configure a network in linux or am I just to stupid?
Last edited by Gh0str1d3r on Wed May 19, 2010 7:39 am; edited 1 time in total |
|
Back to top |
|
 |
Ant P. Watchman

Joined: 18 Apr 2009 Posts: 6920
|
Posted: Mon May 17, 2010 2:27 pm Post subject: Re: how to setup static ip? |
|
|
Gh0str1d3r wrote: | Code: | ifplugd_eth0="134.34.143.182 netmask 255.255.255.1289" |
|
1289? |
|
Back to top |
|
 |
John R. Graham Administrator


Joined: 08 Mar 2005 Posts: 10797 Location: Somewhere over Atlanta, Georgia
|
Posted: Mon May 17, 2010 2:38 pm Post subject: |
|
|
Have you looked in /etc/conf.d/net.example (or, if you're using openrc, /usr/share/doc/openrc*/net.example)? The examples in there are pretty easy to understand.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
 |
Gh0str1d3r Guru

Joined: 27 May 2008 Posts: 411
|
Posted: Mon May 17, 2010 2:45 pm Post subject: Re: how to setup static ip? |
|
|
Ant_P wrote: | Gh0str1d3r wrote: | Code: | ifplugd_eth0="134.34.143.182 netmask 255.255.255.1289" |
|
1289? |
you are right, that was a typo, but without it still does not work (same output of ifconfig).
I checked that example, and set up the config as I understood it. I dont see the error. |
|
Back to top |
|
 |
cst Apprentice

Joined: 24 Feb 2008 Posts: 203 Location: /proc
|
Posted: Mon May 17, 2010 10:28 pm Post subject: |
|
|
Code: | config_eth0=( "134.34.143.182/25" ) |
you only should need this in your /etc/conf.d/net _________________ i7 3930K @ 4GHz
MSI X79A-GD45 (8D)
32GB 1600 MHz DDR3 Samsung
Samsung 840 PRO, 2xSamsung HD502HJ in RAID 1
MSI GTX 980Ti
latest gentoo-sources on x86_64 Fluxbox (amd64)
best render farm: www.GarageFarm.NET |
|
Back to top |
|
 |
Gh0str1d3r Guru

Joined: 27 May 2008 Posts: 411
|
Posted: Tue May 18, 2010 7:55 am Post subject: |
|
|
cst wrote: | Code: | config_eth0=( "134.34.143.182/25" ) |
you only should need this in your /etc/conf.d/net |
I am using openrc. according to /usr/share/doc/openrc-0.6.1-r1/net.example, there shouldn't be brackets, or am I wrong? |
|
Back to top |
|
 |
cst Apprentice

Joined: 24 Feb 2008 Posts: 203 Location: /proc
|
Posted: Tue May 18, 2010 8:41 am Post subject: |
|
|
Gh0str1d3r wrote: |
I am using openrc. according to /usr/share/doc/openrc-0.6.1-r1/net.example, there shouldn't be brackets, or am I wrong? |
I also have openrc , although I dont have static ip and I have brackets, did you try it? _________________ i7 3930K @ 4GHz
MSI X79A-GD45 (8D)
32GB 1600 MHz DDR3 Samsung
Samsung 840 PRO, 2xSamsung HD502HJ in RAID 1
MSI GTX 980Ti
latest gentoo-sources on x86_64 Fluxbox (amd64)
best render farm: www.GarageFarm.NET |
|
Back to top |
|
 |
Gh0str1d3r Guru

Joined: 27 May 2008 Posts: 411
|
Posted: Tue May 18, 2010 9:22 am Post subject: |
|
|
there is no difference, same result with brackets. I found out that the problem is ifplugd. If I unmerge it, and change the config to
Code: | # cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#modules="dhcpcd"
config_eth0="134.34.143.182 netmask 255.255.255.128"
routes_eth0="default via 134.34.143.129"
dns_servers_eth0="134.34.3.2 134.34.3.3"
# Prefer wpa_supplicant over wireless-tools
modules="wpa_supplicant"
# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet
wpa_supplicant_wlan1="-Dwext"
|
then it works. Any ideas how to make it work with ifplugd? (I know that ifplugd doesnt make sense in that particular case, but I don't want to emerge and unmerge it always when changing my computer location) |
|
Back to top |
|
 |
py-ro Veteran


Joined: 24 Sep 2002 Posts: 1734 Location: Velbert
|
Posted: Tue May 18, 2010 1:47 pm Post subject: |
|
|
Just install ifplugd, it will be used automagical.
Py |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23590
|
Posted: Wed May 19, 2010 2:21 am Post subject: |
|
|
If you are moving your system around, why are you using a static IP address? If you are not moving the system around, why do you need ifplugd? |
|
Back to top |
|
 |
Gh0str1d3r Guru

Joined: 27 May 2008 Posts: 411
|
Posted: Wed May 19, 2010 7:39 am Post subject: |
|
|
Hu wrote: | If you are moving your system around, why are you using a static IP address? If you are not moving the system around, why do you need ifplugd? |
I need a static ip at some place that doesnt provide dhcp. In all other places, I am using dhcp and ifplugd. Now after unmerging and reemerging ifplugd, it works with that config:
Code: | $ cat /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#modules="dhcpcd"
config_eth0="134.34.143.182 netmask 255.255.255.128"
routes_eth0="default via 134.34.143.129"
dns_servers_eth0="134.34.3.2 134.34.3.3"
# Prefer wpa_supplicant over wireless-tools
modules="wpa_supplicant"
# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet
wpa_supplicant_wlan1="-Dwext"
|
It definitely does not work with the ifplugd_eth0=.... that is suggested in the ifplugd-howto and also not with ifconfig_eth0=...
But anyway, now it works. So thank you all for your help. |
|
Back to top |
|
 |
|