View previous topic :: View next topic |
Author |
Message |
Kasumi_Ninja Veteran
Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sat Jan 19, 2008 8:59 pm Post subject: Can I lock the ip addresses my router gives to the lan? |
|
|
I would like to give the computers in my lan a fix ip. Is this possible? If so how do I properly configure Gentoo? Should I fill in the desired ip address in /etc/conf.d/net? _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
|
magic919 Advocate
Joined: 17 Jun 2005 Posts: 2182 Location: Berkshire, UK
|
Posted: Sat Jan 19, 2008 9:26 pm Post subject: |
|
|
Yes. |
|
Back to top |
|
|
psomas Retired Dev
Joined: 23 Sep 2006 Posts: 212 Location: Greece
|
Posted: Sat Jan 19, 2008 9:30 pm Post subject: Re: Can I lock the ip addresses my router gives to the lan? |
|
|
Aniruddha wrote: | I would like to give the computers in my lan a fix ip. Is this possible? If so how do I properly configure Gentoo? Should I fill in the desired ip address in /etc/conf.d/net? |
if you have a router, and you use dhcpd you could set a very high value for lease time...
or,don't use dhcpd, and configure your network for static ip...
check this... _________________ myblog
FOSS NTUA Community |
|
Back to top |
|
|
Kasumi_Ninja Veteran
Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sat Jan 19, 2008 10:26 pm Post subject: |
|
|
If I understand correctly I have two options:
1) Specify the desired ip address in /etc/conf.d/net
Code: | config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default via 192.168.0.1" ) |
2) Or if your router supports it add a DHCP Reservation to your router.
I wonder:
-Do all routers have an option to add a DHCP Reservation?
-If not, will setting the desired ip address in /etc/conf.d/net have the same effect? _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
|
tarpman Veteran
Joined: 04 Nov 2004 Posts: 1083 Location: Victoria, BC, Canada
|
Posted: Sat Jan 19, 2008 10:43 pm Post subject: |
|
|
I have yet to see a consumer level router that offers static DHCP leases. My preferred solution is to flash an alternate firmware such as DD-WRT, which offers that and other advanced features. _________________ Saving the world, one kilobyte at a time. |
|
Back to top |
|
|
Kasumi_Ninja Veteran
Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sat Jan 19, 2008 10:51 pm Post subject: |
|
|
tarpman wrote: | I have yet to see a consumer level router that offers static DHCP leases. My preferred solution is to flash an alternate firmware such as DD-WRT, which offers that and other advanced features. |
If I am not mistaken my router (D-link DGL-4300) supports that:
Code: | Add DHCP Reservation
Enable :
Computer Name : <<
IP Address :
MAC Address : |
Code: | HCP Reservations List
Enable Computer Name MAC Address IP Address
computer_name mac_address Edit Delete |
Since most consumer level router don't provide this functionality I still wonder if setting the desired ip address in /etc/conf.d/net have the same effect as setting a DHCP reservation in a router. _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
|
think4urs11 Bodhisattva
Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
Posted: Sat Jan 19, 2008 10:52 pm Post subject: |
|
|
Aniruddha wrote: | -Do all routers have an option to add a DHCP Reservation? |
some do, some don't; check it's documentation
Aniruddha wrote: | -If not, will setting the desired ip address in /etc/conf.d/net have the same effect? |
if your router (or your dhcp server in general) isn't aware of a box which has an IP configured which is in it's dhcp scope there is a chance that this ip gets assigned to a dhcp client -> double IP in your network.
Normally the scope can be set (e.g. from .10 to .200), then you can savely configure a machine with a static ip <10 or >200 _________________ Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Sat Jan 19, 2008 11:26 pm Post subject: |
|
|
Think4UrS11 wrote: | Normally the [DHCP] scope can be set (e.g. from .10 to .200), then you can savely configure a machine with a static ip <10 or >200 | This is the method I used. My personal, physical computers and VMs are assigned static IPs (/etc/conf.d/net) outside the DHCP address range set in my router (.200 - .239). My office laptop, on the rare occasions I connect it to my home 'net, uses DHCP.
tarpman wrote: | I have yet to see a consumer level router that offers static DHCP leases. | Really? I have two from different manufacturers, both fairly ordinary, both several years old and both offer the feature. I wonder if it was more common a few years ago.
@Aniruddha: Note also that a better router will hash MAC addresses to IP leases and store that map indefinitely. The same IP address, if still available, is issued to a previously-seen MAC address if and when it renews an expired lease. My aforementioned laptop has been issued the same IP address for years, even though the lease time is only one week and it may be off the network for months. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
Kasumi_Ninja Veteran
Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sat Jan 19, 2008 11:48 pm Post subject: |
|
|
Ok I get it. If a router doesn't support a DHCP reservation I must manually this. To achieve this I:
1) Set the ip address scope of the router to >10 or <200
2) Specify the ip address I want in /etc/conf.d/net
I do have some questions about configuring /etc/conf.d/net . According to net.example I enter the following line for a static configuration:
Code: | # For a static configuration, use something like this
# (They all do exactly the same thing btw)
#config_eth0=( "192.168.0.2/24" )
#config_eth0=( "192.168.0.2 netmask 255.255.255.0" ) |
My questions are:
1) According to the handbook I also need to set "routes_eth0". Is this true?
Code: | Code Listing 2.6: Manually setting IP information for eth0
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default via 192.168.0.1" ) |
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8#doc_chap2
2) What does the /24 part of 192.168.0.2/24 mean?
3) Is entering config_eth0=( "192.168.0.201 netmask 255.255.255.0" ) in /etc/conf.d/net enough for the configuration of an static ip? _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
|
think4urs11 Bodhisattva
Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
Posted: Sat Jan 19, 2008 11:57 pm Post subject: |
|
|
Aniruddha wrote: | 3) Is entering config_eth0=( "192.168.0.201 netmask 255.255.255.0" ) in /etc/conf.d/net enough for the configuration of an static ip? |
As long as you don't want to access the internet yes, otherwise you need the routes_eth0 additionally
/24 is the same as netmask 255.255.255.0; it tells you how much of the 32 bit an IP address (v4) are the network part (those are set to 1) or the host part (those are set to 0)
The network in this case is 192.168.0 - your host is .2
All hosts within the same network can directly communicate with each other. Machines in different networks need a router for that
You only need to configure a router/default gateway if you want to reach other machines outside of your LAN _________________ Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself |
|
Back to top |
|
|
Kasumi_Ninja Veteran
Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jan 20, 2008 12:04 am Post subject: |
|
|
Think4UrS11 wrote: | Aniruddha wrote: | 3) Is entering config_eth0=( "192.168.0.201 netmask 255.255.255.0" ) in /etc/conf.d/net enough for the configuration of an static ip? |
As long as you don't want to access the internet yes, otherwise you need the routes_eth0 additionally |
I think I get it! With the routes option you set the ip address of your router right?
@timeBandit
Thanks. Didn't know that. _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
|
|