en0 identifies a network device. Wi-Fi is commonly the name of a configured network service. A proxy command asking for a service name expects the latter kind of identifier.

Start with the names the machine actually has:

networksetup -listallnetworkservices

Use the complete service name from that output. It might be Wi-Fi, a USB adapter's descriptive name, or a name someone assigned locally. A disabled service can be marked with an asterisk in the listing; that marker is not part of the name to copy.

For an illustrative service named Office Ethernet, setting an HTTP proxy looks like:

networksetup -setwebproxy "Office Ethernet" proxy.example.internal 8080

The quotes preserve the space in the service name. The proxy hostname and port are separate arguments. Substitute the real values; for a test that permits public HTTP endpoints, the HTTP proxy list supplies candidates. Use the privileges required by the machine's administration policy.

Setting that service does not configure another service simply because both can access the internet. A Mac with Ethernet and Wi-Fi connected may have multiple relevant configurations. Check the service carrying the affected application's connection before applying the same change elsewhere.

Also keep the protocol-specific settings separate. A web-proxy setting, a secure-web destination proxy, a SOCKS proxy and an automatic PAC URL are different configuration entries. Changing the HTTP entry does not establish that all the others should be switched on or off together.

Apple's older Remote Desktop command reference already distinguishes network services in these commands. On the machine being managed, use networksetup -help to confirm its available options and then verify the intended service in Network settings. A device identifier obtained from an interface listing is not a substitute for selecting that service.

متعلقہ مضامین