OpenWrt Forum Archive

Topic: hand out the same ip i got as client via dhcp?

The content of this topic has been archived on 9 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hi folks,

i want to do something like this:
- wrt is wireless client and get its public ip via dhcp.
- wrt is server to exactly one ethernet client and hand out a ip via dhcp.

now the tricky part:
i want the both ips to be the same.

the computer i want to plug (via ethernet) into the wrt isn't able to be wireless client, but should get the public ip!
so what i want is to use the wrt as an kind of "wlan-cable".

anyone could point me to a way to do this?

note: please dont point me to bridging lan and wlan. the wireless client has to have a specific mac address, and i'm not able to change the mac of the wired computer.

thanx
and bye form
berlin

You really don't want to this at IP level. It's a mess and it won't work properly.

Instead, if the scenario you described is complete (as in there are no other obstacles), then I'd suggest that you create a bridge between one ethernet port and the wireless interface.

For this to work you'll need to disable udhcpc on the WLAN interface and udhcpd (or DHCP part of dnsmasq) on the one ethernet port. You could use the WAN port as it's already seperated from the other 4 ports by default, I think it's called vlan1.

You can then give the bridged interface private IP address, add a route to this IP on your workstation, and still be able to access your wrt.

This way your wrt won't hold/have the public IP. It will instead bridge all traffic (including DHCP request) from the ethernet port to WLAN and vice versa.

In my opinion, you dont need twice the same ip.
You can masquerade your pc behind the wrt54g,
first split the wlan from bridge br0, then give the wlan your public ip and the lan an local IP (this is your Gateway). All traffic from the local PC shout be masq per iptables,

iptables -t nat -A POSTROUTING -o <wlan-device> -j MASQUERADE

All Traffic from wlan can be Routed to your pc per:

iptables -t nat -A PREROUTING  -i <wlan-device> -j DNAT --to-destination <local PC ip>

Sort of reading between the lines of the original post here - is this a case of the ISP (or whomever is on the other end) requiring a specific MAC for security purposes?
   If you give the router the same MAC as a machine on the inside do you run into routing issues? 
   (If so, is this possibly because all the ports are really running off one interface?)
   Why can't you change the inside machine's MAC?  Is it a VPN issue (it needs the MAC for the VPN algorithm)?
   Seems like it's either a non-problem (responses above should be sufficient) or it's a problem that needs to be resolved in a different manner than described (use the WRT as the VPN endpoint or contact the other end and tell them your MAC is different now.)

The discussion might have continued from here.