Set static IP address

How do I do this using a programmatically set static IP address for the host iPhone.

Accepted Reply

There’s no supported way to programmatically set a static IP address. Why do you want to this?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • I‘m not the original poster, but I have the same need. Background here: I‘m talking to a car‘s central ECU gateway via (wired) ethernet. This device picks a random IP un the 169.254.x.x network. I learn about its IP by sending a UDP broadcast to said network. Now I do not want to burden the user with configuring his wired ethernet on the iPhone to this very address and netmask, so I‘d like to do it programmatically. Is there any way these days?

Add a Comment

Replies

There’s no supported way to programmatically set a static IP address. Why do you want to this?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • I‘m not the original poster, but I have the same need. Background here: I‘m talking to a car‘s central ECU gateway via (wired) ethernet. This device picks a random IP un the 169.254.x.x network. I learn about its IP by sending a UDP broadcast to said network. Now I do not want to burden the user with configuring his wired ethernet on the iPhone to this very address and netmask, so I‘d like to do it programmatically. Is there any way these days?

Add a Comment

so I‘d like to do it programmatically.

AFAIK nothing has changed in this space. There is certainly no way, on iOS, to modify the TCP/IP configuration of a wired Ethernet interfaces.

This device picks a random IP un the 169.254.x.x network.

By “device” do you mean the iOS device? Or your accessory?

If your accessory is choosing a self-assigned IPv4 address [1] then you shouldn’t need to configure a static IP address on the iOS device. By default it will choose a similar self-assigned IPv4 address and that’ll allow you to communicate.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Per RFC 3927 Dynamic Configuration of IPv4 Link-Local Addresses.