Machine A is a home desktop set up with the standard LAN domain 192.168.1.x.
Machine B is a laptop which spends some time at home and some time in the office. It has static IP settings for the office with domain 131.111.25.x .
When machine B is taken home and attached to the LAN, it can't　see or be seen by machine A. The LAN doesn't have a dedicated router, just several client machines connected by a switch. It's not connected to the internet, although it might be in future.
How should B be set up in order that it can maintain its domain and IP address settings for the office, but still participate in the LAN when it is brought home, without having to reset something manually every time?
In particular, is it possible to achieve this by making one of the machines on the LAN a gateway with suitable settings?
Linux variety of all machines is Debian. Thanks for your help.