Re: [gentoo-user] fallback dns servers
Le 22 mai à 06:57:59 Walter Dnes [EMAIL PROTECTED] a écrit notamment: On Sat, May 21, 2005 at 12:35:45PM +0200, Jean Magnan de Bornier wrote I want to execute ln -sf /etc/resolv.conf.fac /etc/resolv.conf *before* /etc/init.d/net.eth0, so that if I am at the fac (my office) location I have these dns set up, but if I am home with dhcp the resolv.conf file will be overwritten. Should I add a script in /etc/init.d for that, or is there something simpler? cheers, I don't think that you can get it done *BEFORE* net.eth0 is run. Gentoo needs to run net.eth0 to set up the network connection. Then it has to query ifconfig to find out what the situation is. I think what you need is to correct resolv.conf if you are at the office. The official Gentoo way to do this would be an init script. I recommend the following... 1) If local is not already in the default runlevel, execute... etc-update add local default 2) In /etc/conf.d/local.start add the following lines if ifconfig eth0 | grep 194\.199\.136\.151 /dev/null ; then cp /etc/resolv.conf.fac /etc/resolv.conf fi *IMPORTANT*. You must *COPY* /etc/resolv.conf.fac. If you symlink it to /etc/resolv.conf, then the next time dhcp overwrites /etc/resolv.conf it will be overwriting /etc/resolv.conf.fac Thanks a lot Walter; this is exactly what I needed. I made a test without any internet connection, and the eth0 address as well as the /etc/resolv.conf file had the right (office) values, coming back with my home dhcp connection eveything's OK. I appreciate your help, -- Jean Magnan de Bornier | email: jean-at-bornier.net -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
On Sat, 21 May 2005 12:35:45 +0200, Jean Magnan de Bornier wrote: I want to execute ln -sf /etc/resolv.conf.fac /etc/resolv.conf *before* /etc/init.d/net.eth0, so that if I am at the fac (my office) location I have these dns set up, but if I am home with dhcp the resolv.conf file will be overwritten. Should I add a script in /etc/init.d for that, or is there something simpler? See the preup() function in /etc/conf.d/net, this is executed before the interface is brought up. -- Neil Bothwick Philosophical error: Demonstrate the existence of a key to continue pgpSNipz8VsBc.pgp Description: PGP signature
Re: [gentoo-user] fallback dns servers
Le 22 mai à 12:15:44 Neil Bothwick [EMAIL PROTECTED] a écrit notamment: On Sat, 21 May 2005 12:35:45 +0200, Jean Magnan de Bornier wrote: I want to execute ln -sf /etc/resolv.conf.fac /etc/resolv.conf *before* /etc/init.d/net.eth0, so that if I am at the fac (my office) location I have these dns set up, but if I am home with dhcp the resolv.conf file will be overwritten. Should I add a script in /etc/init.d for that, or is there something simpler? See the preup() function in /etc/conf.d/net, this is executed before the interface is brought up. Thanks Neil, I adopted Walter's solution but I'll look at yours (I will have to find a fresh /etc/conf.d/net, as I wiped out all unncessary lines). :-( cheers, -- Jean Magnan de Bornier | email: jean-at-bornier.net -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
Thanks Neil, I adopted Walter's solution but I'll look at yours (I will have to find a fresh /etc/conf.d/net, as I wiped out all unncessary lines). :-( It's in the baselayout, simply extract it from there. HTH, hannes pgpOVEcyAEd2d.pgp Description: PGP signature
Re: [gentoo-user] fallback dns servers
Le 22 mai à 18:39:09 Johannes Weiner [EMAIL PROTECTED] a écrit notamment: Thanks Neil, I adopted Walter's solution but I'll look at yours (I will have to find a fresh /etc/conf.d/net, as I wiped out all unncessary lines). :-( It's in the baselayout, simply extract it from there. Great, I'll look there Thanks, -- Jean Magnan de Bornier | email: jean-at-bornier.net -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
On Sun, 22 May 2005 18:20:29 +0200, Jean Magnan de Bornier wrote: See the preup() function in /etc/conf.d/net, this is executed before the interface is brought up. Thanks Neil, I adopted Walter's solution but I'll look at yours (I will have to find a fresh /etc/conf.d/net, as I wiped out all unncessary lines). :-( /etc/conf.d/net/example :) -- Neil Bothwick Beware of low-flying butterflies. pgpLTKppOorHG.pgp Description: PGP signature
Re: [gentoo-user] fallback dns servers
Le 22 mai à 20:11:00 Neil Bothwick [EMAIL PROTECTED] a écrit notamment: On Sun, 22 May 2005 18:20:29 +0200, Jean Magnan de Bornier wrote: See the preup() function in /etc/conf.d/net, this is executed before the interface is brought up. Thanks Neil, I adopted Walter's solution but I'll look at yours (I will have to find a fresh /etc/conf.d/net, as I wiped out all unncessary lines). :-( /etc/conf.d/net/example :) I don't have such a directory (/etc/conf.d/net/). I found a complete /etc/conf.d/net file on another machine but saw no preup() function there (my system is up-to-date) Maybe I missed something? -- Jean Magnan de Bornier | email: jean-at-bornier.net -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
On Sun, May 22, 2005 8:18 pm, Jean Magnan de Bornier said: /etc/conf.d/net/example :) I don't have such a directory (/etc/conf.d/net/). Sorry, that should be /etc/conf.d/net.example -- Neil Bothwick -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
Le 17 mai à 15:01:49 Jean Magnan de Bornier [EMAIL PROTECTED] a écrit notamment: Hello all, I am setting up a way to have my laptop automatically get a correct ip address. When I am at my office, I have a fixed ip; at home (on a private network) I use dhcp. I know I can use quickswitch for that but I want something really automatic, so after some search I ended up with this in my /etc/conf.d/net: iface_eth0=dhcp ifconfig_eth0=( dhcp 194.199.136.151 ) dhcpcd_eth0=-t 30 ifconfig_fallback_eth0=( 194.199.136.151 netmask 255.255.255.0 ) ipaddr_fallback_eth0=( 194.199.136.151 gw 194.199.136.250 ) This works great, but as dhcp overwrites /etc/resolv.conf, when I go back to my fixed ip my dns servers are not the ones I need (still the ones I use at home). My dns names for office are set in /etc/resolv.conf.fac. Is there a way to have the machine know which dns servers to use? Well, as my question is not answered yet, let me reformulate what I need in a shorter way: I want to execute ln -sf /etc/resolv.conf.fac /etc/resolv.conf *before* /etc/init.d/net.eth0, so that if I am at the fac (my office) location I have these dns set up, but if I am home with dhcp the resolv.conf file will be overwritten. Should I add a script in /etc/init.d for that, or is there something simpler? cheers, -- Jean Magnan de Bornier | email: jean-at-bornier.net -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
On Sat, May 21, 2005 at 12:35:45PM +0200, Jean Magnan de Bornier wrote I want to execute ln -sf /etc/resolv.conf.fac /etc/resolv.conf *before* /etc/init.d/net.eth0, so that if I am at the fac (my office) location I have these dns set up, but if I am home with dhcp the resolv.conf file will be overwritten. Should I add a script in /etc/init.d for that, or is there something simpler? cheers, I don't think that you can get it done *BEFORE* net.eth0 is run. Gentoo needs to run net.eth0 to set up the network connection. Then it has to query ifconfig to find out what the situation is. I think what you need is to correct resolv.conf if you are at the office. The official Gentoo way to do this would be an init script. I recommend the following... 1) If local is not already in the default runlevel, execute... etc-update add local default 2) In /etc/conf.d/local.start add the following lines if ifconfig eth0 | grep 194\.199\.136\.151 /dev/null ; then cp /etc/resolv.conf.fac /etc/resolv.conf fi *IMPORTANT*. You must *COPY* /etc/resolv.conf.fac. If you symlink it to /etc/resolv.conf, then the next time dhcp overwrites /etc/resolv.conf it will be overwriting /etc/resolv.conf.fac -- Walter Dnes [EMAIL PROTECTED] An infinite number of monkeys pounding away on keyboards will eventually produce a report showing that Windows is more secure, and has a lower TCO, than linux. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
On Tue, 17 May 2005, Jean Magnan de Bornier wrote: Hello all, I am setting up a way to have my laptop automatically get a correct ip address. When I am at my office, I have a fixed ip; at home (on a private network) I use dhcp. I know I can use quickswitch for that but I want something really automatic, so after some search I ended up with this in my /etc/conf.d/net: iface_eth0=dhcp ifconfig_eth0=( dhcp 194.199.136.151 ) dhcpcd_eth0=-t 30 ifconfig_fallback_eth0=( 194.199.136.151 netmask 255.255.255.0 ) ipaddr_fallback_eth0=( 194.199.136.151 gw 194.199.136.250 ) This works great, but as dhcp overwrites /etc/resolv.conf, when I go back to my fixed ip my dns servers are not the ones I need (still the ones I use at home). My dns names for office are set in /etc/resolv.conf.fac. Is there a way to have the machine know which dns servers to use? # esearch quickswitch [ Results for search key : quickswitch ] [ Applications found : 1 ] * app-admin/quickswitch Latest version available: 1.05 Latest version installed: [ Not Installed ] Size of downloaded files: 19 kB Homepage:http://quickswitch.sf.net Description: Utility to switch network profiles on the fly License: GPL-2 -- Aj. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] fallback dns servers
Hi A., on Thursday, 2005-05-19 at 13:59:38, you wrote: I know I can use quickswitch for that but I want something really automatic, [...] iface_eth0=dhcp ifconfig_eth0=( dhcp 194.199.136.151 ) [...] # esearch quickswitch Yeah, I guess he knew that ;-) I'm just wondering: where can I find info like the above? Reading the init scripts it's fairly obvious but also fairly tedious if I have to do this for every release. I'm quite sure it's not in any of the online manuals nor in the conf.d inline documentation...any Changelogs or something? -- I prefer encrypted and signed messages. KeyID: 90CF8389 Fingerprint: 8E 1F 10 81 A4 66 29 46 B9 8A B9 E2 09 9F 3B 91 pgpDWPXBqUBvS.pgp Description: PGP signature