[BusyBox] change IP address on bootup

Brett Hunt bhunt at myrealbox.com
Tue Sep 9 17:49:52 MDT 2003


	

Jason wrote:
> Instead of trying to use the bootloader or init, why don't you just have a
> script called as part of the runlevel scripts, or as part of login, that
> uses your menu. Or, since this is location based, why don't you just run a
> DHCP server?
> 
> > Ideally I would like to add a menu option in inittab (or grub.conf)
> > to prompt the user to select the correct IP address based on their
> > physical location.

You could pass the IP as an option to the kernel. In your grub.conf add
the ip=192.168.0.10 or some other address. Make addresses multiple
options in the file. For example (sorry, my news reader will break long
lines, ] signifies a new line, the other ones are wrapped lines):
] default=0
] timeout=2
]
] title eXMP Linux 2.4.18-24.8.0 Serial Console
]         root (hd0,0)
]         kernel /vmlinuz ro root=/dev/hda2 console=tty0 console=ttyS0,9600
] title eXMP Linux 2.4.18-24.8.0 Serial Console 192.168.0.15
]         root (hd0,0)
]         kernel /vmlinuz ro root=/dev/hda2 console=tty0
console=ttyS0,9600 ip=192.168.1.15
] title eXMP Linux 2.4.18-24.8.0 Serial Console 192.168.1.15
]         root (hd0,0)
]         kernel /vmlinuz ro root=/dev/hda2 console=tty0
console=ttyS0,9600 ip=192.168.1.15

I don't recall now if the kernel will use this address or not. Try it.
You can always add a boot script that looks for ip being set to
something and uses ifconfig to set the ip address to the value stored in
ip. We do that on some systems. ip=bootp and ip=dhcp are also useful.

--
Brett









More information about the busybox mailing list