LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   commands to assign IP (https://www.linuxquestions.org/questions/linux-newbie-8/commands-to-assign-ip-649974/)

yusufs 06-17-2008 04:41 PM

commands to assign IP
 
Hai all,

I have 2 ethernet adapters in my Linux RHEL ES 4 box.. how can I allocate all IP settings (IP,Gateway,DNS ) using commands and activate that ethernet..

Thanks
Yusuf

theriddle 06-17-2008 05:17 PM

I'll assume that the two adapters are eth0 and eth1. Replace words prefixed with $
With static IP:
Code:

ifconfig eth$n $ip # set ip adress
ifconfig eth$n netmask $nmask # probably 255.255.255.0
route add default $gateway # set up gateway through your gateway (probably a router or modem)
ifconfig eth$n up # activate

With DHCP:
Code:

dhclient # it should check both interfaces and activate them automatically


All times are GMT -5. The time now is 09:13 AM.