FORUM HOME | WHUK BLOG   
WEB HOSTING UK AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM
PHP LINUX SHARED HOSTING WINDOWS ASP.NET HOSTING PACKAGES
ECOMMERCE HOSTING ASP MSSQL MS ACCESS ODBC FRONTPAGE HOSTING
CPANEL WHM FANTASTICO RESELLER DEDICATED SERVER WEB HOSTING
CHEAP PLESK CPANEL HTML MYSQL BEST UK VPS HOSTING COMPANY
CHEAP RELIABLE UK HOSTING PROVIDER SINCE 2001
MANAGED WEB HOSTING SERVICE
AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM

Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum » Web Hosting and Domains » FAQ's / Tutorials.

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 23-04-11, 12:29 PM
~Phil~'s Avatar
Member
 
Join Date: Aug 2010
Posts: 32
Default Adding the IPs to a Linux system through command line interface(manually)

If you want to add the IPs to a Linux system through command line interface(manually).

This steps can be pretty useful if you are not having any control panel, such as cPanel, that has a feature to adds ips. If your main ethernet device is eth1 instead of eth0 simply substitute eth1 for eth0.
Other then that should be pretty simple to follow, this should work on any standard redhat/centos based system.


Login to the server with root privileges then simply follow theses steps to add a new ip address to any linux redhat based system.

Quote:
cd /etc/sysconfig/network-scripts

Then as precautionary measure take a backup of the file

cp ifcfg-eth0 ifcfg-eth0.bak


Then copy the config for your new IP
cp ifcfg-eth0 ifcfg-eth0:1

Then we need to edit the new config
vi ifcfg-eth0:1

The lines you need to change:

DEVICE="eth0"
to
DEVICE="eth0:1"

Then change the Ip address value to the new IP thate you wish to add.
IPADDR="xxx.xxx.xxx.xxx"
to be your NEW ip address (it will have your primary ip listed)

This will have saved the config for you and the interface is ready to be brought up. This is done with
/sbin/ifup eth0:1

Having done this if you type
/sbin/ifconfig

You should see something like
------code------
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addrxx.xxx.xxx.xxx Bcastxx.xxx.xxx.xxx Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55818546 errors:0 dropped:0 overruns:0 frame:0
TX packets:46167836 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3299680715 (3146.8 Mb) TX bytes:1890963825 (1803.3 Mb)
Interrupt:11 Base address:0xd000

eth0:1 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:NEW.IP.ADDRESS Bcastxx.xxx.xxx.xxx Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0xd000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:241244 errors:0 dropped:0 overruns:0 frame:0
TX packets:241244 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:66571100 (63.4 Mb) TX bytes:66571100 (63.4 Mb)
------/code------
If you then try to ping your new ip it should all work fine
This should also restart eth0:1 on a reboot as its a direct copy of the eth0 config. So checking for the ONBOOT="yes" in the file ifcfg-eth0:1 will ensure it DOES come back up on a reboot.
Reply With Quote

  #2 (permalink)  
Old 24-04-11, 07:21 AM
Kristian0911's Avatar
new member
 
Join Date: Apr 2011
Posts: 7
Default

In addition to the valuable Information above I would like to contribute a bit. The above steps are good for adding 1-2 IPs. If you would like to add Multiple IPs or range of IPs to your Linux Server through command line, just follow the steps as :

Code:
1. Back up, then delete all files matching /etc/sysconfig/network-scripts/ifcfg-eth?:*
2. Create the following /etc/sysconfig/network-scripts/ifcfg-eth0-range0:

      IPADDR_START=10.10.10.20
      IPADDR_END=10.10.10.21
      CLONENUM_START=0

3. /etc/rc.d/init.d/network restart
Thanks

Last edited by Kristian0911; 24-04-11 at 07:27 AM.
Reply With Quote

  #3 (permalink)  
Old 25-04-11, 06:40 PM
Moderator
 
Join Date: Nov 2010
Posts: 131
Default

Quote:
Originally Posted by ~Phil~ View Post
If you want to add the IPs to a Linux system through command line interface(manually).

This steps can be pretty useful if you are not having any control panel, such as cPanel, that has a feature to adds ips. If your main ethernet device is eth1 instead of eth0 simply substitute eth1 for eth0.
Other then that should be pretty simple to follow, this should work on any standard redhat/centos based system.


Login to the server with root privileges then simply follow theses steps to add a new ip address to any linux redhat based system.



If you then try to ping your new ip it should all work fine
This should also restart eth0:1 on a reboot as its a direct copy of the eth0 config. So checking for the ONBOOT="yes" in the file ifcfg-eth0:1 will ensure it DOES come back up on a reboot.
Quote:
Originally Posted by Kristian0911 View Post
In addition to the valuable Information above I would like to contribute a bit. The above steps are good for adding 1-2 IPs. If you would like to add Multiple IPs or range of IPs to your Linux Server through command line, just follow the steps as :

Code:
1. Back up, then delete all files matching /etc/sysconfig/network-scripts/ifcfg-eth?:*
2. Create the following /etc/sysconfig/network-scripts/ifcfg-eth0-range0:

      IPADDR_START=10.10.10.20
      IPADDR_END=10.10.10.21
      CLONENUM_START=0

3. /etc/rc.d/init.d/network restart
Thanks
Thanks for the valuable information you have provided to all of us.

cheer
__________________
UK VPS Hosting || SEO Server || Cloud Hosting
Looking for extra income ?
Join our webhosting affiliate program and earn upto £300 Webhosting UK Affiliate
Reply With Quote

  #4 (permalink)  
Old 27-04-11, 01:07 AM
~Phil~'s Avatar
Member
 
Join Date: Aug 2010
Posts: 32
Default

It’s very encouraging to hear the comments made by Jeffrey and thank you for the same..

I'd also like to thank Kristian0911 for adding his valuable information to this post..

I am sure with the addition this post will become even more useful to all..
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT. The time now is 07:26 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright 2001-2010 Web Hosting UK. All rights reserved.
Web Hosting UK Forum





Site Map

Shared Cloud
Shared Cloud From £1

Affiliate Program
Earn up to £300 Per Sale

Dedicated Servers
Dedicated Server Hosting

Cloud Hosting
Cloud Server Hosting

Load Balanced Server
Load Balancing Server

VPS Hosting
Linux VPS Hosting

Windows VPS
Windows 2003 VPS

Zimbra Hosting
Zimbra Email Hosting

cPanel Hosting
Shared Linux Hosting

Windows Hosting
Shared Windows Hosting

Coldfusion Hosting
Windows Coldfusion Hosting

cPanel Reseller Hosting
Reseller Hosting

Windows Reseller
Windows Reseller Hosting

Email Web Hosting
Email Hosting

Semi-Dedicated Server
Semi-Dedicated Hosting

Remote Backup Plans
Offsite Backup Service


cpanel hosting
Knowledgebase Articles

Pre-Sales Question
Web Hosting FAQ's

Dedicated Hosting
Dedicated Server FAQ's

Virtual Private Servers
VPS Hosting

PHP MySQL Hosting
cPanel Hosting

Windows Hosting
ASP MSSQL Hosting

Domain Name
Domain registration FAQ's

CMS Hosting
CMS Hosting FAQ's

Payment Gateways
Payment FAQ's


Support Tutorials

cPanel Tutorials
cPanel Flash Tutorials

Wordpress Tutorials
Wordpress Flash Tutorials

Plesk Tutorials
Plesk Flash Tutorials

PhpMyadmin Tutorials
PhpMyadmin Flash Tutorials

Drupal Tutorials
Drupal Flash Tutorials

Mambo Tutorials
Mambo Flash Tutorials

Joomla Tutorials
Joomla Flash Tutorials

More Hosting Tutorials