Re: Assigning static ip address
Steve Bertrand wrote: >From what I understand (and correct me if I'm wrong): - you are working on a FreeBSD host system - you have a DHCP server on the network, but it is not on this host - you want to use all of the DHCP assigned parameters on the host, but you want to have a static IP on the host you are working on that is different than the one assigned to you Yep, all your assumptions are correct! I did in fact at some point try creating a lease for the em0 interface in "dhclient.conf", but I understand those leases are only used if the dhcp server is unavailable, and it never had any effect. ... But the dhcp server is in my router, so I followed your suggestion and created a static lease (which before I didn't know I could do), so now everything works - thanks a lot!! br Nikolaj ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
No, it isn't that hard...you could set up rc.conf to get a dynamic IP when the machine starts, and then you could write a startup script and place it in /usr/local/etc/rc.d that sleeps for however long you want the dynamic IP to be active, and then runs ifconfig to reconfigure your IP address to the static you want. You'd want to set up your rc.conf to get the dhcp address at boot time...here are some of the default options...season to taste: dhclient_program="/sbin/dhclient" # Path to dhcp client program. dhclient_flags="" # Extra flags to pass to dhcp client. #dhclient_flags_fxp0="" # Extra dhclient flags for fxp0 only background_dhclient="NO"# Start dhcp client in the background. - "Wherever you go, there you are!" On Thu, 12 Feb 2009, Nikolaj Thygesen wrote: Hi list, I've been experimenting and googling for hours w/ no luck. All I want to do is run dhcp and then replace the ip address of the interface with a new static ip afterwards. I've been looking at the /etc/dhclient.conf man pages, but they don't seem to help. I can do it from rc.conf like: ifconfig_em0="inet 1.2.3.4" but then I loose all the other dhcp parameters like dns and stuff. Is it really that hard??? thanks - Nikolaj ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
On Thursday 12 February 2009 7:33:31 pm Glen Barber wrote: > > Could you plase configure your /etc/rc.conf file to something like this? > > > > ifconfig_ed0="inet 192.168.1.105 netmask 255.255.255.0" > > defaultrouter="192.168.1.1" > > > > Where "defaultrouter" is the IP of your dhcp server and tell me what > > happens? > > AFAIK, this should really be the default gateway IP, not the DHCP server. You are absolutely right ... default gateway should really be the default gateway ... wich in my case it's also my dhco server ( WRT54G Linksys) ... I think I made way too many assumptions on my post ... So .. OP, please: 1) ifconfig_ed0="inet 192.168.1.105 netmask 255.255.255.0" Assign _your_ static ip to "inet" ... 192.168.1.105 is mine and was there just to set an example. Same thing applies to "netmask" As a side note, your static ip, should be out of the range of the valid dhcp lease ips 2) defaultrouter="192.168.1.1" Assing _your_ defaultrouter ip to "defaultrouter" ... 192.168.1.1 is mine and was there just to set an example. Thanks Glen for pointing that out. Regards -- Blessings Gonzalo Nemmi ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
Nikolaj Thygesen wrote: > Hi list, > >I've been experimenting and googling for hours w/ no luck. All I want > to do is run dhcp and then replace the ip address of the interface with > a new static ip afterwards. I've been following this thread all day, but I still don't understand exactly what you are trying to accomplish. >From what I understand (and correct me if I'm wrong): - you are working on a FreeBSD host system - you have a DHCP server on the network, but it is not on this host - you want to use all of the DHCP assigned parameters on the host, but you want to have a static IP on the host you are working on that is different than the one assigned to you If that is correct, then you really only have two options: - do an #ifconfig, and in the configuration on the DHCP server, specify a directly assigned IP address to your MAC address. This way, DHCP server will feed you the same 'static' (aka permanent lease) address to you, and will also provide you with all other configuration parameters, or; - do not configure the IP address on the host via rc.conf. Let dhclient do its job, and have the system run a script at bootup with the requirement that 'network' setup is done, and that will set ONLY the IP address. It would help if you could specify what platform the DHCP server is running on, and whether you have control of it or not. It is important that you don't set a static IP address on your host that the DHCP server has in its lease pool. If you do, it may/will cause IP conflicts on the network. Steve ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
On Thu, Feb 12, 2009 at 10:38:02PM +0100, Nikolaj Thygesen wrote: > Gonzalo Nemmi wrote: > >On Thursday 12 February 2009 6:00:04 pm Nikolaj Thygesen wrote: > > > >Could you plase configure your /etc/rc.conf file to something like this? > > > >ifconfig_ed0="inet 192.168.1.105 netmask 255.255.255.0" > >defaultrouter="192.168.1.1" > > > >Where "defaultrouter" is the IP of your dhcp server and tell me what > >happens? > > > >Regards > > > When I do, I get: > > em0: flags=8843 metric 0 mtu 1500 >options=19b >ether 00:1b:21:1b:fd:bd >inet6 fe80::21b:21ff:fe1b:fdbd%em0 prefixlen 64 scopeid 0x1 >inet 192.168.1.105 netmask 0xff00 broadcast 192.168.1.255 >media: Ethernet autoselect (1000baseTX ) >status: active > > I still get no connectivity until i run "dhclient em0" which gives me: > > em0: flags=8843 metric 0 mtu 1500 >options=19b >ether 00:1b:21:1b:fd:bd >inet6 fe80::21b:21ff:fe1b:fdbd%em0 prefixlen 64 scopeid 0x1 >inet 192.168.1.105 netmask 0xff00 broadcast 192.168.1.255 >inet 10.0.0.2 netmask 0xff00 broadcast 10.0.0.255 >media: Ethernet autoselect (1000baseTX ) >status: active > > adding what I guess is called an alias 10.0.0.2 ip?!?! I'm not that much > of an expert in these matters, and I'm a bit puzzled why, at first > (before calling dhclient), it can't resolve addresses eventhough > "/etc/resolv.conf" contains all my dns's. I think you need to turn off dhclient in /etc/rc.conf - or don't turn it on. Also, make sure your resolv.conf is correct and the default router is correctly set in /etc/rc.conf to your gateway address.It looks like your ifconfig might be correct, but either or both of resolv.conf or default router is wrong or dhclient is running and clobbering them. jerry > >br - N > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
ifconfig_em0="inet 1.2.3.4" but then I loose all the other dhcp parameters like dns and stuff. Is it really that hard??? echo nameserver yourdns >/etc/resolv.conf and turn off dhclient of course ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
Gonzalo Nemmi wrote: On Thursday 12 February 2009 6:00:04 pm Nikolaj Thygesen wrote: Could you plase configure your /etc/rc.conf file to something like this? ifconfig_ed0="inet 192.168.1.105 netmask 255.255.255.0" defaultrouter="192.168.1.1" Where "defaultrouter" is the IP of your dhcp server and tell me what happens? Regards When I do, I get: em0: flags=8843 metric 0 mtu 1500 options=19b ether 00:1b:21:1b:fd:bd inet6 fe80::21b:21ff:fe1b:fdbd%em0 prefixlen 64 scopeid 0x1 inet 192.168.1.105 netmask 0xff00 broadcast 192.168.1.255 media: Ethernet autoselect (1000baseTX ) status: active I still get no connectivity until i run "dhclient em0" which gives me: em0: flags=8843 metric 0 mtu 1500 options=19b ether 00:1b:21:1b:fd:bd inet6 fe80::21b:21ff:fe1b:fdbd%em0 prefixlen 64 scopeid 0x1 inet 192.168.1.105 netmask 0xff00 broadcast 192.168.1.255 inet 10.0.0.2 netmask 0xff00 broadcast 10.0.0.255 media: Ethernet autoselect (1000baseTX ) status: active adding what I guess is called an alias 10.0.0.2 ip?!?! I'm not that much of an expert in these matters, and I'm a bit puzzled why, at first (before calling dhclient), it can't resolve addresses eventhough "/etc/resolv.conf" contains all my dns's. br - N ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
> > Could you plase configure your /etc/rc.conf file to something like this? > > ifconfig_ed0="inet 192.168.1.105 netmask 255.255.255.0" > defaultrouter="192.168.1.1" > > Where "defaultrouter" is the IP of your dhcp server and tell me what happens? > AFAIK, this should really be the default gateway IP, not the DHCP server. -- Glen Barber ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
On Thursday 12 February 2009 6:00:04 pm Nikolaj Thygesen wrote: > Hi list, > > I've been experimenting and googling for hours w/ no luck. All I > want to do is run dhcp and then replace the ip address of the interface > with a new static ip afterwards. I've been looking at the > /etc/dhclient.conf man pages, but they don't seem to help. I can do it > from rc.conf like: > > ifconfig_em0="inet 1.2.3.4" > > but then I loose all the other dhcp parameters like dns and stuff. Is it > really that hard??? > > thanks - Nikolaj Could you plase configure your /etc/rc.conf file to something like this? ifconfig_ed0="inet 192.168.1.105 netmask 255.255.255.0" defaultrouter="192.168.1.1" Where "defaultrouter" is the IP of your dhcp server and tell me what happens? Regards -- Blessings Gonzalo Nemmi ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
Nikolaj Thygesen wrote: Hi list, I've been experimenting and googling for hours w/ no luck. All I want to do is run dhcp and then replace the ip address of the interface with a new static ip afterwards. I've been looking at the /etc/dhclient.conf man pages, but they don't seem to help. I can do it from rc.conf like: ifconfig_em0="inet 1.2.3.4" but then I loose all the other dhcp parameters like dns and stuff. Is it really that hard??? thanks - Nikolaj Your rc.conf line is incomplete. Even if that line was complete, your route would be missing Your /etc/resolv.conf gets rewritten by dhclient every time it renews the IP. Given your rc.conf statement is incomplete, is why you lose 100% connectivity. Basic networking on a LAN (meaning: NO INTERNET) is IP address and subnet basic networking ON the internet needs a router in addition to the above full internet working needs DNS server in addition to the above. You don't even hit the Basic w/out Internet. Please either give details from rc.conf, or read it's manpage so we can point you to the manpage again. --Tim ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Assigning static ip address
Nikolaj Thygesen wrote: Hi list, I've been experimenting and googling for hours w/ no luck. All I want to do is run dhcp and then replace the ip address of the interface with a new static ip afterwards. I've been looking at the /etc/dhclient.conf man pages, but they don't seem to help. I can do it from rc.conf like: ifconfig_em0="inet 1.2.3.4" but then I loose all the other dhcp parameters like dns and stuff. Is it really that hard??? thanks - Nikolaj Is there a reason you don't set /etc/resolv.conf to static nameservers as well? Also does not fixed-address lease give you what you want? -- Adam Vandemore Systems Administrator IMED Mobility (605) 498-1610 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Assigning static ip address
Hi list, I've been experimenting and googling for hours w/ no luck. All I want to do is run dhcp and then replace the ip address of the interface with a new static ip afterwards. I've been looking at the /etc/dhclient.conf man pages, but they don't seem to help. I can do it from rc.conf like: ifconfig_em0="inet 1.2.3.4" but then I loose all the other dhcp parameters like dns and stuff. Is it really that hard??? thanks - Nikolaj ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"