# Is it possible to have same IP on wireless and wired?

## nickeh

Hi! 

I just got my self a Dell XPS m1530 with iwl4965 wireless card. 

After a lot of work and resarch I've got things to work sort of lik i want I have ifplugd so that the wireless is put down when plugged. This works just fine but my problem is that when i switch between the wireless and wired all my portforwards in the router have to be reconfigured if i want them to work since i get a different IP for the wired and the wireless...

So is it possible to do something so that the wired and wireless appears to be the same for the router?

----------

## pappy_mcfae

If by, "appears the same," you mean, "has the same IP address no matter which network interface is active," the answer is a guarded, "yes." There are some things about my setup you might not like.

1) The net adapter (wired or wireless) is chosen at boot time using wired nic carrier as the decision algorithm.

2) In order to change modes, you have to reboot.

3) If both devices are internal (not PCMCIA adapters), baselayout-2 is not recommended. This is because the interface needs to be renamed.

4) It does not work with ifplugd.

If you're interested, I can send you the scripts I made to allow my newest laptop to show up as eht0 whether the wired or wireless adapter becomes the active adapter. They are fairly simple, as long as you understand basic scripting.

Blessed be!

Pappy

----------

## UberLord

Create a bridge interface with the wired and wireless as ports.

Some wireless interfaces cannot be bridged though.

----------

## kimmie

If you've got port forwards you should be using a "fixed host" in your DHCP server... you might find your router allows you to configure two fixed hosts with different MACs, one for each interface) but the same IP. I used to do this but then the a firmware upgrade to my router "fixed" that feature.

Now what I do is set the MAC address of the wired and wireless adapter to be the same on the client. That wasy the DHCP server sees it as a single computer which is moving around the network. If I connect to the wired lan, I just disable the wireless adapter. This is a windows laptop, sorry I don't know how to force an interface MAC for a linux client, but I'm sure it's possible.

Having the same IP is useful even without port forwards, because anything that caches DNS info (eg. squid, nscd) can get confused if your computer suddenly switches IP.

----------

## nickeh

 *UberLord wrote:*   

> Create a bridge interface with the wired and wireless as ports.
> 
> Some wireless interfaces cannot be bridged though.

 

Trying to set up a bridge now but i dont understand how to build a bridge that accepts one of the interfaces being down?

Heris my config now:

```

## WIRED

#config_eth0=( "dhcp" )

dhcp_eth0="nodns" # Manage resolve.conf manually

## WIRELESS

#config_wlan0=( "dhcp" )

dhcpcd_wlan0="-t 30" #Timeout after 30 seconds

dhcp_wlan0="nodns" 

modules_wlan0=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

## BRIDGE

#Configure bridge man brctl for details

brctl_br0=( "setfd 0" "sethello 0" "stp on" ) 

#Add ports

bridge_br0="eth0 wlan0"

config_eth0=( "null" )

config_wlan0=( "null" )

config_br0=( "dhcp" )

depend_br0() {

   need net.eth0 net.wlan0

}

```

But when i try to start the bridge and i have wired plugd (ifplug has shut wlan0 down) it complains about wlan0 beeing down?

----------

## UberLord

So don't depend on any interfaces, or change the depend from "need" to "after"  :Smile: 

----------

## nickeh

 *UberLord wrote:*   

> So don't depend on any interfaces, or change the depend from "need" to "after" 

 

Ah, thats nice. Will try this when i come home tomorrow.

However, one thought. When bringing wlan0 down i also remove the kernel module for wireless since it wont restart properly otherwise... So if wlan0 is down i guess the br will complain over wlan0 device not beeing available? Are there any solution to this or do i have to figure a way out so that iwl4965 always is loaded when br0 is starting? 

Will the bridge break if i unload the module after initialising the bridge? 

Thanks for the help, really appreciated. Haven't gotten around to understanding more advanced networking in linux since I havn't had any use of it until now... Got to love linux for alwys giving you something to thinker with  :Smile: 

----------

## nickeh

Okay, now I feel like beeing halfway there.

I have eth0 and wlan0 added to the bridge. wlan0 is up and is connected eth0 is unplugged. br0 seems to start without problems but fails to recieve ip from dhcpcd.

ifconfig output befor starting br0

```
eth0      Link encap:Ethernet  HWaddr 00:15:C5:86:38:7A  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:16 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:11651 (11.3 Kb)  TX bytes:11651 (11.3 Kb)

wlan0     Link encap:Ethernet  HWaddr 00:1F:3B:C0:38:ED  

          inet addr:192.168.0.8  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:85903 (83.8 Kb)  TX bytes:36842 (35.9 Kb)

wmaster0  Link encap:UNSPEC  HWaddr 00-1F-3B-C0-38-ED-38-80-00-00-00-00-00-00-00-00  

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

```

Starting br0

```

konstig nicke # /etc/init.d/net.br0 start

 * Starting br0

 *   Running preup function                                               [ ok ]

 *   Creating bridge br0 ...                                              [ ok ]

 *   Adding ports to br0

 *     eth0 ...                                                           [ ok ]

 *     wlan0 ...                                                          [ ok ]

 *   Bringing up br0

 *     dhcp

 *       Running dhcpcd ...

err, br0: timed out

warn, br0: using IPV4LL address 169.254.4.74                              [ ok ]

 *       br0 received address 169.254.4.74/16

 *   Running postup function

 *     Mounting fusesmb ...

mount: according to mtab, fusesmb is already mounted on /mnt/samba

                                                                          [ ok ]

```

ifconfig after br0 is started

```

br0       Link encap:Ethernet  HWaddr 00:15:C5:86:38:7A  

          inet addr:169.254.4.74  Bcast:169.254.255.255  Mask:255.255.0.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:2463 (2.4 Kb)  TX bytes:13134 (12.8 Kb)

eth0      Link encap:Ethernet  HWaddr 00:15:C5:86:38:7A  

          UP BROADCAST PROMISC MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:16 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:11799 (11.5 Kb)  TX bytes:11799 (11.5 Kb)

wlan0     Link encap:Ethernet  HWaddr 00:1F:3B:C0:38:ED  

          inet addr:192.168.0.8  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:89198 (87.1 Kb)  TX bytes:61596 (60.1 Kb)

wmaster0  Link encap:UNSPEC  HWaddr 00-1F-3B-C0-38-ED-38-80-00-00-00-00-00-00-00-00  

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

```

----------

## UberLord

Does it work if you add a static IP and/or remove the wireless interface from the bridge?

----------

## nickeh

Now its getting close. I got a bridge with eth0 and wlan0 and the connection is working when i have eth0 plugged but not when i try using the bridge via wlan0....

Could be my that my brother uses Mac filtering on his router so i have to find a way to set the mac of the bridge to be the same as wlan0Last edited by nickeh on Tue Jul 08, 2008 3:43 pm; edited 1 time in total

----------

## UberLord

As I said earlier, bridging won't work with most wireless cards.

I'm told this is due to how wireless works in Linux, but iirc some cards work. Maybe Google can tell you more.

----------

## nickeh

 *UberLord wrote:*   

> As I said earlier, bridging won't work with most wireless cards.
> 
> I'm told this is due to how wireless works in Linux, but iirc some cards work. Maybe Google can tell you more.

 

Will dig around some more on google will post solution here if found

Ended up adding the following to /etc/conf.d/net

```

mac_eth0= [the mac from wlan0]

```

----------

