Networking Forums

Networking Forums > Computer Networking > Linux Networking > ip change on interface with subinterfaces.

Reply
Thread Tools Display Modes

ip change on interface with subinterfaces.

 
 
Pedros
Guest
Posts: n/a

 
      12-19-2005, 09:40 AM
Hi,
propably an easy question but could someone tell me how to change ip address
for eth1 without having to restart the interface. That interface has 7
(eth1.2-eth1.8) subinterfaces and I relally wouldn't like to shutdown all
the subinterfaces to change the ip for eth1.
does
"ifconfig eth1 new.ip.address.ress netmask 255.255.255.0 broadcast
new.ip.add.255 up"
do the thing, without interfearing to functionality of other interfaces?
Does it affect to routing table any way else but what the new ip causes?
The distro is Fedora Core 1
Thanx in advance.

~pete
 
Reply With Quote
 
 
 
 
prg
Guest
Posts: n/a

 
      12-19-2005, 02:01 PM

Pedros wrote:
> Hi,
> propably an easy question but could someone tell me how to change ip address
> for eth1 without having to restart the interface. ...


Ie., you want to delete the _primary_address_ on eth1 -- which will
automatically clear the sub-interface addresses. What do you want to
do with the sub-interface addresses? Continue to use them as is?
Change them to sub-interface addresses of the _new_primary_ address?

> ... That interface has 7
> (eth1.2-eth1.8) subinterfaces and I relally wouldn't like to shutdown all
> the subinterfaces to change the ip for eth1.


As soon as you delete the primary address the sub-interface (secondary)
addresses will clear.

> does
> "ifconfig eth1 new.ip.address.ress netmask 255.255.255.0 broadcast
> new.ip.add.255 up"
> do the thing, without interfearing to functionality of other interfaces?


Can't remember about ifconfig behavior. But with something like:

# ip address add 192.168.100.0/24 brd + dev eth1

You would _add_ a new address without affecting others. IF it is
_also_ in the same subnet space as an _existing_ address, it will be a
secondary address (sub-interface).

> Does it affect to routing table any way else but what the new ip causes?


As soon as you delete _any_ address, there are likely side
affects/deletions in the route table cache (arp cache also?) -- I can't
recall offhand :-(

OTOH,
# ip address flush dev eth1
would _definitely_ clear _all_ addresses from eth1 _and_ clean up the
caches.

> The distro is Fedora Core 1


The ip utility if much more flexible/capable than ifconfig. In fact,
if you look at your network startup scripts you will see that they
using ip commands ;-)

IF you are adding a new address to eth1 that is _unrelated_ to existing
addresses and the present secondary addresses are to be changed to
become secondary addresses of the _new_ address, then you could add the
new addresses first, then delete the old primary address (which will
clear the secondaries automaticall).

The side affects on _current_ connections and cached arp/route table
entries on _this_ machine you can control somewhat, but the same cached
info on other machines will have to time out before the old info
clears. Side effects? Could range from barely noticed to an office
riot of screams ;-)

Check these two site links on how you can overcome these quirks of
secondary addresses using ip commands. Be warned, it may be more work
than you care for till you get comfortable with ip commands.

http://linux-ip.net/html/
http://linux-ip.net/html/basic-changing.html
http://linux-ip.net/html/tools-ip-management.html

http://www.policyrouting.org/iproute2-toc.html

hth and good luck,
prg

 
Reply With Quote
 
Pedros
Guest
Posts: n/a

 
      12-20-2005, 08:45 AM
Ok, sorry that I didn't tell why I want to do this. The situation at the
moment is as follows. The server with those interfaces is acting as a
router. Every subinterface has its own class-c lan. The primary interface
eth1 is unused, and I'm only using subinterfces to route traffic. Now I
came up with a problem -> cause the lan configured on eth1 was found
configured to another lan that is going to be connected to mine. So I have
to change the ip address for eth1 to be able to route traffic to that new
location.


~pete

prg wrote:

>
> Pedros wrote:
>> Hi,
>> propably an easy question but could someone tell me how to change ip
>> address
>> for eth1 without having to restart the interface. ...

>
> Ie., you want to delete the _primary_address_ on eth1 -- which will
> automatically clear the sub-interface addresses. What do you want to
> do with the sub-interface addresses? Continue to use them as is?
> Change them to sub-interface addresses of the _new_primary_ address?
>
>> ... That interface has 7
>> (eth1.2-eth1.8) subinterfaces and I relally wouldn't like to shutdown all
>> the subinterfaces to change the ip for eth1.

>
> As soon as you delete the primary address the sub-interface (secondary)
> addresses will clear.
>
>> does
>> "ifconfig eth1 new.ip.address.ress netmask 255.255.255.0 broadcast
>> new.ip.add.255 up"
>> do the thing, without interfearing to functionality of other interfaces?

>
> Can't remember about ifconfig behavior. But with something like:
>
> # ip address add 192.168.100.0/24 brd + dev eth1
>
> You would _add_ a new address without affecting others. IF it is
> _also_ in the same subnet space as an _existing_ address, it will be a
> secondary address (sub-interface).
>
>> Does it affect to routing table any way else but what the new ip causes?

>
> As soon as you delete _any_ address, there are likely side
> affects/deletions in the route table cache (arp cache also?) -- I can't
> recall offhand :-(
>
> OTOH,
> # ip address flush dev eth1
> would _definitely_ clear _all_ addresses from eth1 _and_ clean up the
> caches.
>
>> The distro is Fedora Core 1

>
> The ip utility if much more flexible/capable than ifconfig. In fact,
> if you look at your network startup scripts you will see that they
> using ip commands ;-)
>
> IF you are adding a new address to eth1 that is _unrelated_ to existing
> addresses and the present secondary addresses are to be changed to
> become secondary addresses of the _new_ address, then you could add the
> new addresses first, then delete the old primary address (which will
> clear the secondaries automaticall).
>
> The side affects on _current_ connections and cached arp/route table
> entries on _this_ machine you can control somewhat, but the same cached
> info on other machines will have to time out before the old info
> clears. Side effects? Could range from barely noticed to an office
> riot of screams ;-)
>
> Check these two site links on how you can overcome these quirks of
> secondary addresses using ip commands. Be warned, it may be more work
> than you care for till you get comfortable with ip commands.
>
> http://linux-ip.net/html/
> http://linux-ip.net/html/basic-changing.html
> http://linux-ip.net/html/tools-ip-management.html
>
> http://www.policyrouting.org/iproute2-toc.html
>
> hth and good luck,
> prg


 
Reply With Quote
 
Pedros
Guest
Posts: n/a

 
      12-27-2005, 12:59 PM
If someone happens to bump in to this same "problem"... "ifconfig eth1
ip.add.re.ss mask xxx.xxx.xxx.xxx"
(And of course changed the new ip address information to startup scripts...)
did it with no side effects, all the subinterfaces and routes continued to
work just fine after ip change.

~pete

Pedros wrote:

> Ok, sorry that I didn't tell why I want to do this. The situation at the
> moment is as follows. The server with those interfaces is acting as a
> router. Every subinterface has its own class-c lan. The primary interface
> eth1 is unused, and I'm only using subinterfces to route traffic. Now I
> came up with a problem -> cause the lan configured on eth1 was found
> configured to another lan that is going to be connected to mine. So I have
> to change the ip address for eth1 to be able to route traffic to that new
> location.
>
>
> ~pete
>
> prg wrote:
>
>>
>> Pedros wrote:
>>> Hi,
>>> propably an easy question but could someone tell me how to change ip
>>> address
>>> for eth1 without having to restart the interface. ...

>>
>> Ie., you want to delete the _primary_address_ on eth1 -- which will
>> automatically clear the sub-interface addresses. What do you want to
>> do with the sub-interface addresses? Continue to use them as is?
>> Change them to sub-interface addresses of the _new_primary_ address?
>>
>>> ... That interface has 7
>>> (eth1.2-eth1.8) subinterfaces and I relally wouldn't like to shutdown
>>> all the subinterfaces to change the ip for eth1.

>>
>> As soon as you delete the primary address the sub-interface (secondary)
>> addresses will clear.
>>
>>> does
>>> "ifconfig eth1 new.ip.address.ress netmask 255.255.255.0 broadcast
>>> new.ip.add.255 up"
>>> do the thing, without interfearing to functionality of other interfaces?

>>
>> Can't remember about ifconfig behavior. But with something like:
>>
>> # ip address add 192.168.100.0/24 brd + dev eth1
>>
>> You would _add_ a new address without affecting others. IF it is
>> _also_ in the same subnet space as an _existing_ address, it will be a
>> secondary address (sub-interface).
>>
>>> Does it affect to routing table any way else but what the new ip causes?

>>
>> As soon as you delete _any_ address, there are likely side
>> affects/deletions in the route table cache (arp cache also?) -- I can't
>> recall offhand :-(
>>
>> OTOH,
>> # ip address flush dev eth1
>> would _definitely_ clear _all_ addresses from eth1 _and_ clean up the
>> caches.
>>
>>> The distro is Fedora Core 1

>>
>> The ip utility if much more flexible/capable than ifconfig. In fact,
>> if you look at your network startup scripts you will see that they
>> using ip commands ;-)
>>
>> IF you are adding a new address to eth1 that is _unrelated_ to existing
>> addresses and the present secondary addresses are to be changed to
>> become secondary addresses of the _new_ address, then you could add the
>> new addresses first, then delete the old primary address (which will
>> clear the secondaries automaticall).
>>
>> The side affects on _current_ connections and cached arp/route table
>> entries on _this_ machine you can control somewhat, but the same cached
>> info on other machines will have to time out before the old info
>> clears. Side effects? Could range from barely noticed to an office
>> riot of screams ;-)
>>
>> Check these two site links on how you can overcome these quirks of
>> secondary addresses using ip commands. Be warned, it may be more work
>> than you care for till you get comfortable with ip commands.
>>
>> http://linux-ip.net/html/
>> http://linux-ip.net/html/basic-changing.html
>> http://linux-ip.net/html/tools-ip-management.html
>>
>> http://www.policyrouting.org/iproute2-toc.html
>>
>> hth and good luck,
>> prg


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Traffic through subinterfaces ppogoda@gmail.com Linux Networking 3 12-13-2007 03:03 PM
dhcp for subinterfaces jeroen Linux Networking 1 10-24-2005 10:37 AM
Change MAC address without down interface macd55 Linux Networking 0 10-11-2004 10:08 PM
Linux API to create logical interface on a physical interface? Zarko Coklin Linux Networking 2 07-18-2004 01:50 AM
SNAT with multiple mappings: subinterfaces needed? Joe Drago Linux Networking 1 06-15-2004 03:33 PM



1 2 3 4 5 6 7 8 9 10 11