Red Hat, Fedora Linux,Debian GNU/Linux DHCP Configuration

Linux DHCP Configuration

Red Hat and Fedora Linux:

  1. Start the GUI network administration/configuration tool by typing redhat-config-network (Red Hat 9 and Enterprise 3.0) or system-config-network (Fedora) at a shell prompt.
  2. Make sure your network interface (typically eth0) is highlighted and click the Edit icon.
  3. Select the Automatically obtain IP address settings with dhcp radio button.
  4. Check the Automatically obtain DNS information from provider checkbox.
  5. Select Save from the File menu and close the window.

Alternately,

  1. Run ifconfig to identify your network interface (typically eth0).
  2. Bring down the network interface with ifdown eth0.
  3. Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 so that it contains only the following lines for eth0:
                  DEVICE=eth0
                  BOOTPROTO=dhcp
                  ONBOOT=yes
  4. Bring the network interface back up with ifup eth0.

Debian GNU/Linux

  1. Run ifconfig to identify your network interface (typically eth0).
  2. Bring down the network interface with ifdown eth0.
  3. Edit /etc/network/interfaces so that the only lines for eth0 are:
                  auto eth0
                  iface eth0 inet dhcp
                  
  4. Bring the network interface back up with ifup eth0.

 

For Ubuntu Linux

To add IP address on eth0 interface

sudo ifconfig eth0 10.0.0.99 netmask 255.255.255.0 

ifconfig eth0 (to check eth0)

sudo route add default gw 10.0.0.1 eth0 (to add gateway to eth0 interface)

To verify your default gateway configuration, you can use the route command in the following manner.

route -n 

sudo ifup eth0 (to enable the interface eth0)

sudo ifdown eth0 (to disable the interface eth0) 

How to reset root password on CentOS

How to reset root password on CentOS 6

When we forgot password root on Centos, we can reset that password easily. We have to use single mode to do that.

Step 1: Hard reboot your Server, and Configure in GRUB, Choose “e” to edit GRUB

Step 2: Choose kernel line and type “e”

Step 3: In kernel configuration , we have 2 methods to change to single mode. 1 we can use number “1″, 2 we can use character “S ” or “Single”. Enter after done.

Step 4:  Choose kernel which we just made change and type “b” to boot

Step 5:  Now we are in single mode, we can reset password and reboot Server with new root password.

Cmd: passwd (enter) OR

Cmd: passwd root (enter)

That’s all.

Device eth0 does not seem to be present in Virtual Machine

virtualbox centos6 guest – Device eth0 does not seem to be present

I follow this topic, and my problem is the same. But I must change MAC Address in two files:

change from /etc/udev/rules.d/70-persistant-net.rules

# PCI device 0x1022:0x2000 (pcnet32) (custom name provided by external tool)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”<Old MAC Address>”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

PCI device 0x1022:0x2000 (pcnet32)

#SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”<Old MAC Address>”, “, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

to

# PCI device 0x1022:0x2000 (pcnet32) (custom name provided by external tool)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”<New MAC Address>”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

#PCI device 0x1022:0x2000 (pcnet32)

#SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”<New MAC Address>”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

And change in /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

HWADDR=<Old MAC Address>

NM_CONTROLLED=yes

ONBOOT=yes

IPADDR=192.168.1.89

BOOTPROTO=none

NETMASK=255.255.255.0

TYPE=Ethernet

GATEWAY=192.168.1.11

DNS1=8.8.8.8

IPV6INIT=no

USERCTL=no

to:

DEVICE=eth0

HWADDR=<New MAC Address>

NM_CONTROLLED=yes

ONBOOT=yes

IPADDR=192.168.1.89

BOOTPROTO=none

NETMASK=255.255.255.0

TYPE=Ethernet

GATEWAY=192.168.1.11

DNS1=8.8.8.8

IPV6INIT=no

USERCTL=no

Hope it helps everyone come to this topic.

If issue didn’t resolve with the above solution then delete the 70-persistent

——————————————————————————————————————

The easiest way to fix this problem is to simply delete the file. Linux will regenerate it properly the next time it boots up.

#bash: rm /etc/udev/rules.d/70-persistent-net.rules

After deleting the file, you need to reboot. After rebooting, ifconfig should show eth0 and everything should just work.If you’re feeling less adventurous, you can rename the file to *.old so that you can restore it if something doesn’t work:

#bash: mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.old

 

i forgot to tell you that in the dmesg log i also noticed that dev has changed the eth to eth1, so i edited the /etc/sysconfig/network-scripts/ifcfg-eth0 and also renamed it to/etc/sysconfig/network-scripts/ifcfg-eth1. 

#cat /var/log/dmesg  |grep -i eth

—————————————————————————————————————–

To edit the files use vi editor to view the file use cat

After doing the above configuration reboot the linux machine #shutdown -h now or restart the interface

To restart the Network Interfaces

/etc/init.d/network restart

or

/etc/init.d/networking restart