setup multiple IP on single NIC

Hi

I want to serve 2 different webistes from same machine, each site having it’s own IP.
i have slightest idea that i have to change /etc/sysconfig/network/ifcfg-eth0 but I am not sure what to change.

BOOTPROTO=‘static’
BROADCAST=’’
ETHTOOL_OPTIONS=’’
IPADDR=‘111.222.111.222’
MTU=’’
NAME=‘82540EM Gigabit Ethernet Controller’
NETMASK=’’
NETWORK=’’
REMOTE_IPADDR=’’
STARTMODE=‘auto’
USERCONTROL=‘no’

Should I create new file “ifcfg-eth1” or add something to existing file “ifcfg-eth0” to enable system to get another IP 121.212.121.212

Thanks.

Should I create new file “ifcfg-eth1” or add something to existing file “ifcfg-eth0” to enable system to get another IP 121.212.121.212

No, the configuration will relate to the eth0 device only. You want to set up ethernet aliasing.

BTW, you can achieve this with the YaST network utility:

YaST >> Network Devices >> Network Settings, select the appropriate NIC device, and select ‘Edit’. Add the required IP address aliases there.

Thanks for reply.
I added IPADDR_2 = ‘121.212.121.212’ to ifcfg-eth0 and it worked.

I will remember next time about Yast. I thought I could do that only from desktop/window mode but I just checked after reading your comments and now I know bit better.

thanks again

if you make this how can you make the difference when you try to access from outside ???
this is interesting but at same time i m not understand the meaning …
till today i have think that network cards can only have one ip address at a time is this correct ?
if so how can you do this and create the difference …??

Can you please explain me this …

Tank s

Hi
I have setup apache as folows

Listen 127.0.0.1:80
Listen 127.0.0.2:80

NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerAdmin admin@localhost
DocumentRoot C:/apache2/htdocs
ServerAlias 127.0.0.1
ServerName localhost
</VirtualHost>

#Virtual hosts for PhpStorm

<VirtualHost 127.0.0.1:80>
ServerAdmin admin@localhost
DocumentRoot g:/projects/phpstorm/concepts
ServerName concepts.jet
</VirtualHost>
<VirtualHost 127.0.0.1:80>
ServerAdmin admin@localhost
DocumentRoot g:/projects/phpstorm/yiiblog
ServerName yiiblog.jet
</VirtualHost>

<VirtualHost 127.0.0.2:80>
ServerAdmin admin@localhost
DocumentRoot g:/projects/phpstorm/drupal6
ServerName drupal6.jet
</VirtualHost>

now when i go to 127.0.0.2 i get redirected to my drupal installation.
I am using it for IP based virtual hosts. If you are talking in some different context then I don’t have much knowledge about that. it is working for apache and for my purpose. I wanted to test SSL based multiple IP hosting.

For any physical network card,

  • You generally configure at least one network interface. That is the “device” the operating system will reference when sending data destined for that network card. It’s possible to configure multiple network interfaces for a specified physical network card, but that starts getting into advanced uses… If you’re just beginning to understand this, those advanced scenarios should be ignored for now.

  • As part of the configuration of an interface, various network settings are configured like IP address, subnetwork mask, default gateway, other gateways, name resolution and more. And yes, you <can> configure more than one IP address for the interface, but be aware this normally only done on Servers… There is no benefit and can cause plenty of problems if you do this on a Network Client.

On openSUSE the recommended way to configure the network card and interface is using YAST, it will prevent you from making many mistakes if you edit the network device configuration files directly.

Note also that if you have Network Manager installed, at least on KDE it looks like one of the “newer” features is to configure multiple IP addresses.

If mymind or anyone else has a further question how to access/configure, you’ll have to be more detailed and descriptive what you’re asking.

HTH,
TS

HTH,
TS