How to apply static ip address


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to apply static ip address
# 1  
Old 03-12-2009
Question How to apply static ip address

Hi there,
I have a Debian 5.0 server newly installed.
By default, the ip address is given by dhcp.
Code:
pegase:~# grep '^[^#]' /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
pegase:~# head -2 /etc/hosts
127.0.0.1       localhost
127.0.1.1       pegase.apltest  pegase

Then I modify the files so that they look like this:
Code:
pegase:~# grep '^[^#]' /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
        address 192.168.1.251
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
pegase:~# head -2 /etc/hosts
127.0.0.1       localhost
192.168.1.251   pegase.apltest  pegase

Then I try to apply changes with:
Code:
pegase:~# /etc/init.d/networking restart

But at that point, I loose eth0:
Code:
pegase:~# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

And the only way to apply changes is to reboot the server.
Is this normal? How can I switch from dhcp to static address without rebooting?
Thanks for your help.
Santiago
# 2  
Old 03-12-2009
I found it...
It's because of the following statement:
allow-hotplug eth0
that should be replaced by
auto eth0
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Unable to set static ip address

Hi All, Am using centos 7 in my vmware workstatio with the bridged network. when run the ifconfig cmd its not at all showing the ip address and pls advise how to set static ip address in my linux box. (1 Reply)
Discussion started by: sarathkumar s
1 Replies

2. IP Networking

Configuring static ip address on several systems

p { margin-bottom: 0.1in; line-height: 120%; }a:link { } Hello, I'm have an interesting issue with some Raspberry Pi's which I have on my home network. The pi's are on 192.168.1.102, 192.168.1.103, 192.168.1.104 Something very strange is happening on my network. The pi on 192.168.1.104 is... (2 Replies)
Discussion started by: JoeOnaMac
2 Replies

3. IP Networking

Free subdomain to my IP Address and Static IP

Hi all, I would need to register a random free subdomain address and associate that to my IP Address. Any suggestion of a good service? Also I don't have a static IP but i remember that there are services that automatically reset the right IP address behind the subdomain but i don't remember... (1 Reply)
Discussion started by: Tameto
1 Replies

4. Red Hat

Static IP Address setup for vm as well as the host system

Hello, Greetings!! I have a server with 3 TB of disk space and 12 GB RAM and a i7 processor. What I did thus far is to install Oracle Enterprise Linux (OEL 5.7)as the host system and install Oracle Virtual box and created 3 VM's. Installed OEL 5.7 on one of the VM, working on installing... (1 Reply)
Discussion started by: rparavastu
1 Replies

5. Red Hat

Purpose of Static IP address through DHCP

Hi All, Could you please explain the purpose of assigning the static IP by using the DHCP Concept. Like by using the clients MAC address we assign the static IP Address. Waiting for your reply. Thanks in Advance. (6 Replies)
Discussion started by: Sharath Kumar
6 Replies

6. UNIX for Dummies Questions & Answers

Static IP address works on Ethernet but not Wireless

Hi all, I have literally spent all day trying dozens of different combinations, re-installs and tweaks to try and resolve this problem. I would be EXTREMELY grateful if anyone can help/point me in the right direction. I am using OpenBSD 4.6 and am trying to connect to my wireless network with... (1 Reply)
Discussion started by: wcontm
1 Replies

7. UNIX for Dummies Questions & Answers

Static IP address for solaris 10 virtual machine

Hi All I am having a solaris 10 virtual machine on vista (using vmware 7) laptop. Now i want to access virtual machine from vista using putty. Problem is that i insalled the solaris machine as dhcp. and whenever i connect to internet or reboot my system the IP address of solaris... (1 Reply)
Discussion started by: ankurk
1 Replies

8. Solaris

How to Configure a Static Ip Address

Hello friend, I am new in UNIX, but I want to learn a lot Well I have a problem to try to configure my PC with a static IP Address (IP 192.168.1.39, Mask 255.255.255.0, gateway 192.168.1.1) (DNS 200.48.225.130 and 200.48.225.146). where are the file that I must be change? The SO is Sun Solaris... (15 Replies)
Discussion started by: andresguillen
15 Replies

9. Solaris

Add Static Routes to new physical address

Hi, I need help to add new route: 10.252.0.138, GW 10.252.0.129 to e1000g1 and 10.252.0.10, GW 10.252.0.1 to e1000g2 tnx (4 Replies)
Discussion started by: mehrdad68
4 Replies

10. UNIX for Dummies Questions & Answers

Slow from static IP ... fast from NAT address

Has anyone had an issue where: If I telnet into a unix machine on my network, from within my natted address, there is no speed issue. When I telnet to the same machine using the static address, it is very very slow. This SCO 5.06. There is no nameserver running. Please help. I have... (3 Replies)
Discussion started by: gseyforth
3 Replies
Login or Register to Ask a Question