If you want your node to share a public IP address with host (i.e. NAT), then @Nikita's answer applies.
However, if you want the node to access the same subnet as the host with a separate IP address, then you need to bridge the real interface eth0
and connect both the host and the node to the network through the bridge.
If you only have one network interface, making a change like this remotely is risky. If the server is hosted at a datacenter, ther eis often a remote hands service available to help you make changes like this.
1. bridge the physical port
edit your current configuration (/etc/sysconfig/network-scripts/ifcfg-eth0
) to remove any IP address configuration and add:
BRIDGE=br0
2. Assign
Create a new configuration for your virtual bridge (/etc/sysconfig/network-scripts/ifcfg-br0
).
DEVICE=br0
TYPE=Bridge
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
DELAY=0
3. Apply Changes
With changes like this, restarting the host is the most reliable way to apply the changes.
Once restarted, you should see your bridge in brctl show
.
Remote Changes
Network changes like this are best done in person. If you make an error in the configuration, you will need physical access to fix it.
In the past, I have written a watchdog script to help me make risky network changes remotely. When enabled, it polled an upstream server to detect network connectivity and, if the network was unavailable, it would revert to the last good network configuration.