0

Is there a de-facto 'standard' for the gateway address on class C subnets?

Asking because I've been fighting a docker-compose issue with macvlans where it assumes the gateway is always at 192.x.x.1, while the actual gateway is 192.x.x.251

Roddy
  • 280
  • 1
  • 4
  • 9

1 Answers1

1

Technically it can be whatever you want and no standards impact it bar any in an organisation.

In practice its almost always .1, sometimes .254 or one of the others above 250, but its noticeably rare for it to be not be .1.

I'd guess 90%+ are .1

For your docker-compose issue I believe the below will work, taken from: https://forums.docker.com/t/how-do-i-attach-a-macvlan-network-and-assign-a-static-ip-address-in-compose-file/107419 and not tested by me.

networks:
  vlan:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: "192.168.0.0/24"
          ip_range: "192.168.0.64/26"
          gateway: "192.168.0.1"
Sam Foley
  • 66
  • 1
  • 4
  • Thanks. FYI it seems there's a docker compose issue open on this still https://github.com/docker/compose/issues/6569 – Roddy Mar 18 '22 at 08:51
  • @Roddy oh yeah didn't see that one, looks like its resolved and working and the open issue is just a code fix though! – Sam Foley Mar 18 '22 at 08:56