How to configure network on Linux

Depending on Linux distros there be might few different ways to configured network interfaces. In a perfect world there would be only one way to do it 🙂

So the below may work at the time of writing or it may change in the the future. Based on what we got at the moment the below should be correct and should allow you to configure your network.

If you are using a VMWARE or Virtual Box I am recommending to change the network card settings into bridged instead of NAT due to some limitation.

As always please leave comments or questions or let me know if you know a better way of configuring it so we can benefit together from it!

1. Redhat based distros (CentOS, Fedora)

as root

#system-config-network

or

edit manually file in

#vim /etc/sysconfig/network-scripts/ifcfg-eth0 (or eth1)

2. Ubuntu Based Distros

#vim /etc/network/interfaces

you can now configure your network card

auto eth0

iface eth0 intet static (or dhcp)

address 192.168.1.2

gateway 192.168.1.1

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

Please see pictures above for more info:)

then you can issue

ifconfig eth0 down && ifconfig eth0 up

As long as you are using virtual enviroment you can quickly restart VM’s to see if your desired configuration is in place.

More reading can be done here on this subject:

https://help.ubuntu.com/community/NetworkConfigurationCommandLine/Automatic

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s