Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

How do I turn off a linux server from recieveing a DHCP address

I want to manually configure an interface address; I use ifconfig.   But when ever I plug that interface into the switch, it picks up a DHCP address (i think) .   How do I stop it so I can only use manually config ip addresses
0
jimmycher
Asked:
jimmycher
3 Solutions
 
Joshua GrantomSenior EngineerCommented:
What line did you use for ifconfig?
0
 
Joshua GrantomSenior EngineerCommented:
Have you tried to editing your interface file?

/etc/network/interfaces

delete this if exists
iface eth0 inet dhcp

add this
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
0
 
Dr. KlahnPrincipal Software EngineerCommented:
This is the /etc/networks/interfaces from the linux server on my LAN.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0

#
# The following section is for use when on a 192.168.0 LAN
# with a gateway at 192.168.0.1
# NOTE:  NAMESERVERS ARE NOT DEFINED HERE.
# Nameservers are defined in /etc/resolv.conf
#
iface eth0 inet static
address 192.168.0.201
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

Open in new window


As the file notes, nameservers are not defined in /etc/networks/interfaces,
but instead in /etc/resolv.conf

The /etc/resolv.conf from the same system.  Note that if
the system runs pdnsd or other caching DNS resolver, the
requests should be redirected to 127.0.01 rather than to the
real nameservers.  On your system this will probably not be
the case and you should use the real nameserver.  That is
probably the router itself.

#
# This section is for use when running on a 192.168 LAN.
# without pdnsd or other caching DNS resolver.
#
search testbed.com
nameserver 192.168.0.1

# This section is for use when pdnsd is resolving requests
#  nameserver 127.0.0.1

Open in new window

0
 
gheistCommented:
edit /etc/sysconfig/network-scripts ifcfg-eth0

make sure
BOOTPROTO=none (other options are bootp and dhcp)
0
 
jimmycherAuthor Commented:
Thanks.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now