Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I want to configure 2 IPs (of diffrent Network like 10.40.60.21/24 and 172.16.16.12/24 with default gatways as 172.16.16.10/32) on Single Network Interface Card. Also then i want to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    21

    configuring 2 IPs on Single Network interface in CentOS 5.8


    Hi all, I want to configure 2 IPs (of diffrent Network like 10.40.60.21/24 and 172.16.16.12/24 with default gatways as 172.16.16.10/32) on Single Network Interface Card. Also then i want to modify the default routing on my system. So can anyone help me on this

  2. #2
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    Hello,

    One sollution using the "ifconfig" command:

    ifconfig eth0:1 <new_ip> netmask <new_netmask>

    This will create a virtual network eth0:1 with the new desired settings.

    To make this network available after every restart you will need to change some configuration files. I hope this guide will help you with this: Chapter*13.*Network Interfaces

    Cheers,
    Srj

  3. #3
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    I prefer to use ip (from the iproute package) as it is more capable than ifconfig, and is slowly replacing ifconfig everywhere. here is an example of usage:

    Code:
    ip addr add 192.168.1.2/24 dev eth0
    ip addr add 10.1.1.2/24 dev eth0
    if you really want, you can assign aliases to them (like eth0:0) if you want, but I find those confusing (and iptables doesn't like them!).

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Mar 2009
    Posts
    21

    how to change IP addr, and change the default routing

    Thanku guys for your response, but i have a few questions, that i want to change the IP add of my interface regularly, as my connection to internet is through proxy, and to access net i have to change my IP.
    And next thing is with 2 IPs configured, and one default gateway, i have to add routes so that packets for local network send on another gateway and all other packets are send on default gateway, so how to configure that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •