![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to configure DHCP to Static IP | lee30320 | IP Networking | 5 | 01-27-2009 03:56 AM |
| dhcp and static ip conflicts. | ts97783 | IP Networking | 1 | 11-01-2008 10:08 AM |
| HP-UX 10.xx Changing from static IP to DHCP | Steelysteel | HP-UX | 1 | 08-27-2007 04:55 PM |
| Static | wojtyla | High Level Programming | 6 | 02-25-2005 11:57 AM |
| Static IP | IP Networking | 7 | 05-18-2003 07:33 PM | |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Switching from DHCP to Static IP
I am trying to write a set of scripts for my Ubuntu 810 Server to allow a user to change from DHCP to a user-supplied Static IP, Subnet, Gateway and DNS Servers.
So far I have the following, where $USERCHOICE is a user-entered value in each case: ifconfig eth0 down && ifconfig eth0 $USERCHOICE && ifconfig eth0 up;; ifconfig eth0 down && ifconfig netmask $USERCHOICE && ifconfig eth0 up;; ifconfig eth0 down && route add default gw $USERCHOICE && ifconfig eth0 up;; ifconfig eth0 down && echo "nameserver $USERCHOICE" > /etc/resolv.conf && ifconfig eth0 up;; Problems: 1.It doesn't work , even after issuing /etc/init.d/networking restart2. Is there an easy way to, from a script, take multiple values and run each command using the appropriate value rather than running each component as a different option? 3. How do I specify 2 DNS Servers instead of 1? I suspect someone out there is already doing this, and in a much more straightforward fashion that I am attempting to Thanks for any help. Alex |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|