Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can I lock the ip addresses my router gives to the lan?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Kasumi_Ninja
Veteran
Veteran


Joined: 18 Feb 2006
Posts: 1825
Location: The Netherlands

PostPosted: Sat Jan 19, 2008 8:59 pm    Post subject: Can I lock the ip addresses my router gives to the lan? Reply with quote

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
View user's profile Send private message
magic919
Advocate
Advocate


Joined: 17 Jun 2005
Posts: 2182
Location: Berkshire, UK

PostPosted: Sat Jan 19, 2008 9:26 pm    Post subject: Reply with quote

Yes.
Back to top
View user's profile Send private message
psomas
Retired Dev
Retired Dev


Joined: 23 Sep 2006
Posts: 212
Location: Greece

PostPosted: Sat Jan 19, 2008 9:30 pm    Post subject: Re: Can I lock the ip addresses my router gives to the lan? Reply with quote

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
View user's profile Send private message
Kasumi_Ninja
Veteran
Veteran


Joined: 18 Feb 2006
Posts: 1825
Location: The Netherlands

PostPosted: Sat Jan 19, 2008 10:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
tarpman
Veteran
Veteran


Joined: 04 Nov 2004
Posts: 1083
Location: Victoria, BC, Canada

PostPosted: Sat Jan 19, 2008 10:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Kasumi_Ninja
Veteran
Veteran


Joined: 18 Feb 2006
Posts: 1825
Location: The Netherlands

PostPosted: Sat Jan 19, 2008 10:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Sat Jan 19, 2008 10:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Sat Jan 19, 2008 11:26 pm    Post subject: Reply with quote

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? 8O 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
View user's profile Send private message
Kasumi_Ninja
Veteran
Veteran


Joined: 18 Feb 2006
Posts: 1825
Location: The Netherlands

PostPosted: Sat Jan 19, 2008 11:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Sat Jan 19, 2008 11:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Kasumi_Ninja
Veteran
Veteran


Joined: 18 Feb 2006
Posts: 1825
Location: The Netherlands

PostPosted: Sun Jan 20, 2008 12:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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