Virtualization Adapted Adapting Business Processes for Virtual Infrastrcuture (and vice-versa)

2012/03/24

Unix Network IP Address Configuration

Filed under: virtualization — iben @ 13:56

To temporarily configure an IP address, you can use the ifconfig command in the following manner. Just modify the IP address and subnet mask to match your network requirements.

sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0

To verify the IP address configuration of eth0, you can use the ifconfig command in the following manner.

ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:15:c5:4a:16:5a

inet addr:10.0.0.100 Bcast:10.0.0.255 Mask:255.255.255.0

inet6 addr: fe80::215:c5ff:fe4a:165a/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:466475604 errors:0 dropped:0 overruns:0 frame:0

TX packets:403172654 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:2574778386 (2.5 GB) TX bytes:1618367329 (1.6 GB)

Interrupt:16

To configure a default gateway, you can use the route command in the following manner. Modify the default gateway address to match your network requirements.

sudo route add default gw 10.0.0.1 eth0

To verify your default gateway configuration, you can use the route command in the following manner.

route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

10.0.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0

0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 eth0

If you require DNS for your temporary network configuration, you can add DNS server IP addresses in the file /etc/resolv.conf. The example below shows how to enter two DNS servers to /etc/resolv.conf, which should be changed to servers appropriate for your network. A more lengthy description of DNS client configuration is in a following section.

nameserver 8.8.8.8

nameserver 8.8.4.4

If you no longer need this configuration and wish to purge all IP configuration from an interface, you can use the ip command with the flush option as shown below.

ip addr flush eth0

[Note]

Flushing the IP configuration using the ip command does not clear the contents of /etc/resolv.conf. You must remove or modify those entries manually.

via Network Configuration.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress