# LinkProperties

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited Constants](https://developer.android.com/reference/android/net/LinkProperties#inhconstants)\|[Fields](https://developer.android.com/reference/android/net/LinkProperties#lfields)\|[Ctors](https://developer.android.com/reference/android/net/LinkProperties#pubctors)\|[Methods](https://developer.android.com/reference/android/net/LinkProperties#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/net/LinkProperties#inhmethods)  

# LinkProperties

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/net/LinkProperties "View this page in Kotlin")\|Java

`
public

final

class
LinkProperties
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable)`


`

|---|----------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.LinkProperties |

<br />

*** ** * ** ***

Describes the properties of a network link. A link represents a connection to a network. It may have multiple addresses and multiple gateways, multiple dns servers but only one http proxy and one network interface. Note that this is just a holder of data. Modifying it does not affect live networks.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable) |-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) Descriptor bit used with[describeContents()](https://developer.android.com/reference/android/os/Parcelable#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor.                                                                                                                                            | | `int` | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE) Flag for use with[writeToParcel(Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

|                                                                                                                                                          ### Fields                                                                                                                                                          ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator)`<`[LinkProperties](https://developer.android.com/reference/android/net/LinkProperties)`>` | [CREATOR](https://developer.android.com/reference/android/net/LinkProperties#CREATOR) Implement the Parcelable interface. |

|                                                                        ### Public constructors                                                                        ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[LinkProperties](https://developer.android.com/reference/android/net/LinkProperties#LinkProperties())`() ` Constructs a new`LinkProperties`with default values. |

|                                                                                                                                                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                                                                                                                                                    ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                                                            | ` `[addRoute](https://developer.android.com/reference/android/net/LinkProperties#addRoute(android.net.RouteInfo))`(`[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)` route) ` Adds a[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)to this`LinkProperties`.                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                                                                               | ` `[clear](https://developer.android.com/reference/android/net/LinkProperties#clear())`() ` Clears this object to its initial state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` int`                                                                                                                                                | ` `[describeContents](https://developer.android.com/reference/android/net/LinkProperties#describeContents())`() ` Implement the Parcelable interface                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` boolean`                                                                                                                                            | ` `[equals](https://developer.android.com/reference/android/net/LinkProperties#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Compares this`LinkProperties`instance against the target LinkProperties in`obj`.                                                                                                                                                                                                                                                                                                                                                            |
| ` `[Inet4Address](https://developer.android.com/reference/java/net/Inet4Address)                                                                      | ` `[getDhcpServerAddress](https://developer.android.com/reference/android/net/LinkProperties#getDhcpServerAddress())`() ` Get DHCP server address                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[InetAddress](https://developer.android.com/reference/java/net/InetAddress)`>`    | ` `[getDnsServers](https://developer.android.com/reference/android/net/LinkProperties#getDnsServers())`() ` Returns all the[InetAddress](https://developer.android.com/reference/java/net/InetAddress)for DNS servers on this link.                                                                                                                                                                                                                                                                                                                                                                                               |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                 | ` `[getDomains](https://developer.android.com/reference/android/net/LinkProperties#getDomains())`() ` Get the DNS domains search path set for this link.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)                                                                         | ` `[getHttpProxy](https://developer.android.com/reference/android/net/LinkProperties#getHttpProxy())`() ` Gets the recommended[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)(or`null`) set on this link.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                 | ` `[getInterfaceName](https://developer.android.com/reference/android/net/LinkProperties#getInterfaceName())`() ` Gets the interface name for this link.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)`>` | ` `[getLinkAddresses](https://developer.android.com/reference/android/net/LinkProperties#getLinkAddresses())`() ` Returns all the[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)on this link.                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` int`                                                                                                                                                | ` `[getMtu](https://developer.android.com/reference/android/net/LinkProperties#getMtu())`() ` Gets any non-default MTU size set for this link.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` `[IpPrefix](https://developer.android.com/reference/android/net/IpPrefix)                                                                           | ` `[getNat64Prefix](https://developer.android.com/reference/android/net/LinkProperties#getNat64Prefix())`() ` Returns the NAT64 prefix in use on this link, if any.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                 | ` `[getPrivateDnsServerName](https://developer.android.com/reference/android/net/LinkProperties#getPrivateDnsServerName())`() ` Returns the private DNS server name that is in use.                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)`>`     | ` `[getRoutes](https://developer.android.com/reference/android/net/LinkProperties#getRoutes())`() ` Returns all the[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)set on this link.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` int`                                                                                                                                                | ` `[hashCode](https://developer.android.com/reference/android/net/LinkProperties#hashCode())`() ` Generate hashcode based on significant fields Equal objects must produce the same hash code, while unequal objects may have the same hash codes.                                                                                                                                                                                                                                                                                                                                                                                |
| ` boolean`                                                                                                                                            | ` `[isPrivateDnsActive](https://developer.android.com/reference/android/net/LinkProperties#isPrivateDnsActive())`() ` Returns whether private DNS is currently in use on this network.                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` boolean`                                                                                                                                            | ` `[isWakeOnLanSupported](https://developer.android.com/reference/android/net/LinkProperties#isWakeOnLanSupported())`() ` Returns whether the network interface supports WakeOnLAN                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                                                               | ` `[setDhcpServerAddress](https://developer.android.com/reference/android/net/LinkProperties#setDhcpServerAddress(java.net.Inet4Address))`(`[Inet4Address](https://developer.android.com/reference/java/net/Inet4Address)` serverAddress) ` Set DHCP server address.                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                               | ` `[setDnsServers](https://developer.android.com/reference/android/net/LinkProperties#setDnsServers(java.util.Collection<java.net.InetAddress>))`(`[Collection](https://developer.android.com/reference/java/util/Collection)`<`[InetAddress](https://developer.android.com/reference/java/net/InetAddress)`> dnsServers) ` Replaces the DNS servers in this`LinkProperties`with the given[Collection](https://developer.android.com/reference/java/util/Collection)of[InetAddress](https://developer.android.com/reference/java/net/InetAddress)objects.                                                                         |
| ` void`                                                                                                                                               | ` `[setDomains](https://developer.android.com/reference/android/net/LinkProperties#setDomains(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` domains) ` Sets the DNS domain search path used on this link.                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                               | ` `[setHttpProxy](https://developer.android.com/reference/android/net/LinkProperties#setHttpProxy(android.net.ProxyInfo))`(`[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)` proxy) ` Sets the recommended[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)to use on this link, or`null`for none.                                                                                                                                                                                                                                                                             |
| ` void`                                                                                                                                               | ` `[setInterfaceName](https://developer.android.com/reference/android/net/LinkProperties#setInterfaceName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` iface) ` Sets the interface name for this link.                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                                                               | ` `[setLinkAddresses](https://developer.android.com/reference/android/net/LinkProperties#setLinkAddresses(java.util.Collection<android.net.LinkAddress>))`(`[Collection](https://developer.android.com/reference/java/util/Collection)`<`[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)`> addresses) ` Replaces the[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)in this`LinkProperties`with the given[Collection](https://developer.android.com/reference/java/util/Collection)of[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress). |
| ` void`                                                                                                                                               | ` `[setMtu](https://developer.android.com/reference/android/net/LinkProperties#setMtu(int))`(int mtu) ` Sets the Maximum Transmission Unit size to use on this link.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                               | ` `[setNat64Prefix](https://developer.android.com/reference/android/net/LinkProperties#setNat64Prefix(android.net.IpPrefix))`(`[IpPrefix](https://developer.android.com/reference/android/net/IpPrefix)` prefix) ` Sets the NAT64 prefix in use on this link.                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                 | ` `[toString](https://developer.android.com/reference/android/net/LinkProperties#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                                                               | ` `[writeToParcel](https://developer.android.com/reference/android/net/LinkProperties#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Implement the Parcelable interface.                                                                                                                                                                                                                                                                                                                                                                      |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` `[describeContents](https://developer.android.com/reference/android/os/Parcelable#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                    | | ` abstract void` | ` `[writeToParcel](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final Creator<LinkProperties> CREATOR
```

Implement the Parcelable interface.

<br />

## Public constructors

### LinkProperties

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public LinkProperties ()
```

Constructs a new`LinkProperties`with default values.

<br />

## Public methods

### addRoute

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean addRoute (RouteInfo route)
```

Adds a[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)to this`LinkProperties`. If there is a[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)with the same destination, gateway and interface with different properties (e.g., different MTU), it will be updated. If the[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)had an interface name set and that differs from the interface set for this`LinkProperties`an[IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException)will be thrown. The proper course is to add either un-named or properly named[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo).

<br />

|                                                                         Parameters                                                                         ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| `route` | `RouteInfo`: A[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)to add to this object. This value cannot be`null`. <br /> |

|                            Returns                             ||
|-----------|-----------------------------------------------------|
| `boolean` | `true`was added or updated, false otherwise. <br /> |

### clear

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void clear ()
```

Clears this object to its initial state.

<br />

### describeContents

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int describeContents ()
```

Implement the Parcelable interface

<br />

|                                                                                                                         Returns                                                                                                                         ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) <br /> |

### equals

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean equals (Object obj)
```

Compares this`LinkProperties`instance against the target LinkProperties in`obj`. Two LinkPropertieses are equal if all their fields are equal in values. For collection fields, such as mDnses, containsAll() is used to check if two collections contains the same elements, independent of order. There are two thoughts regarding containsAll() 1. Duplicated elements. eg, (A, B, B) and (A, A, B) are equal. 2. Worst case performance is O(n\^2).

<br />

|                                       Parameters                                       ||
|-------|---------------------------------------------------------------------------------|
| `obj` | `Object`: the object to be tested for equality. This value may be`null`. <br /> |

|                               Returns                               ||
|-----------|----------------------------------------------------------|
| `boolean` | `true`if both objects are equal,`false`otherwise. <br /> |

### getDhcpServerAddress

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Inet4Address getDhcpServerAddress ()
```

Get DHCP server address

<br />

|                                                                     Returns                                                                     ||
|-------------------------------------------------------------------------------|------------------------------------------------------------------|
| [Inet4Address](https://developer.android.com/reference/java/net/Inet4Address) | The current DHCP server address. This value may be`null`. <br /> |

### getDnsServers

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<InetAddress> getDnsServers ()
```

Returns all the[InetAddress](https://developer.android.com/reference/java/net/InetAddress)for DNS servers on this link.

<br />

|                                                                                                                                                                                   Returns                                                                                                                                                                                   ||
|-------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[InetAddress](https://developer.android.com/reference/java/net/InetAddress)`>` | An unmodifiable[List](https://developer.android.com/reference/java/util/List)of[InetAddress](https://developer.android.com/reference/java/net/InetAddress)for DNS servers on this link. This value cannot be`null`. <br /> |

### getDomains

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getDomains ()
```

Get the DNS domains search path set for this link. May be`null`if not set.

<br />

|                                                                                                                     Returns                                                                                                                     ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A[String](https://developer.android.com/reference/java/lang/String)containing the comma separated domains to search when resolving host names on this link or`null`. <br /> |

### getHttpProxy

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ProxyInfo getHttpProxy ()
```

Gets the recommended[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)(or`null`) set on this link.

<br />

|                                                                                          Returns                                                                                           ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| [ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo) | The[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)set on this link or`null`. <br /> |

### getInterfaceName

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getInterfaceName ()
```

Gets the interface name for this link. May be`null`if not set.

<br />

|                                                          Returns                                                          ||
|--------------------------------------------------------------------|-------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The interface name set for this link or`null`. <br /> |

### getLinkAddresses

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<LinkAddress> getLinkAddresses ()
```

Returns all the[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)on this link. Typically a link will have one IPv4 address and one or more IPv6 addresses.

<br />

|                                                                                                                                                                              Returns                                                                                                                                                                               ||
|----------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)`>` | An unmodifiable[List](https://developer.android.com/reference/java/util/List)of[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)for this link. This value cannot be`null`. <br /> |

### getMtu

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getMtu ()
```

Gets any non-default MTU size set for this link. Note that if the default is being used this will return 0.

<br />

|                    Returns                     ||
|-------|-----------------------------------------|
| `int` | The mtu value set for this link. <br /> |

### getNat64Prefix

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public IpPrefix getNat64Prefix ()
```

Returns the NAT64 prefix in use on this link, if any.

<br />

|                                                   Returns                                                   ||
|--------------------------------------------------------------------------|-----------------------------------|
| [IpPrefix](https://developer.android.com/reference/android/net/IpPrefix) | the NAT64 prefix or`null`. <br /> |

### getPrivateDnsServerName

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getPrivateDnsServerName ()
```

Returns the private DNS server name that is in use. If not`null`, private DNS is in strict mode. In this mode, applications should ensure that all DNS queries are encrypted and sent to this hostname and that queries are only sent if the hostname's certificate is valid. If`null`and[isPrivateDnsActive()](https://developer.android.com/reference/android/net/LinkProperties#isPrivateDnsActive())is`true`, private DNS is in opportunistic mode, and applications should ensure that DNS queries are encrypted and sent to a DNS server returned by[getDnsServers()](https://developer.android.com/reference/android/net/LinkProperties#getDnsServers()). System DNS will handle each of these cases correctly, but applications implementing their own DNS lookups must make sure to follow these requirements.

<br />

|                                                 Returns                                                 ||
|--------------------------------------------------------------------|-------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The private DNS server name. <br /> |

### getRoutes

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<RouteInfo> getRoutes ()
```

Returns all the[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)set on this link. Only unicast routes are returned for apps targeting Android S or below.

<br />

|                                                                                                                                                                          Returns                                                                                                                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)`>` | An unmodifiable[List](https://developer.android.com/reference/java/util/List)of[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)for this link. This value cannot be`null`. <br /> |

### hashCode

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int hashCode ()
```

Generate hashcode based on significant fields Equal objects must produce the same hash code, while unequal objects may have the same hash codes.

<br />

|                     Returns                      ||
|-------|-------------------------------------------|
| `int` | a hash code value for this object. <br /> |

### isPrivateDnsActive

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isPrivateDnsActive ()
```

Returns whether private DNS is currently in use on this network. When private DNS is in use, applications must not send unencrypted DNS queries as doing so could reveal private user information. Furthermore, if private DNS is in use and[getPrivateDnsServerName()](https://developer.android.com/reference/android/net/LinkProperties#getPrivateDnsServerName())is not`null`, DNS queries must be sent to the specified DNS server.

<br />

|                              Returns                               ||
|-----------|---------------------------------------------------------|
| `boolean` | `true`if private DNS is in use,`false`otherwise. <br /> |

### isWakeOnLanSupported

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isWakeOnLanSupported ()
```

Returns whether the network interface supports WakeOnLAN

<br />

|                                  Returns                                  ||
|-----------|----------------------------------------------------------------|
| `boolean` | `true`if interface supports WakeOnLAN,`false`otherwise. <br /> |

### setDhcpServerAddress

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setDhcpServerAddress (Inet4Address serverAddress)
```

Set DHCP server address.

<br />

|                                         Parameters                                          ||
|-----------------|----------------------------------------------------------------------------|
| `serverAddress` | `Inet4Address`: the server address to set. This value may be`null`. <br /> |

### setDnsServers

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setDnsServers (Collection<InetAddress> dnsServers)
```

Replaces the DNS servers in this`LinkProperties`with the given[Collection](https://developer.android.com/reference/java/util/Collection)of[InetAddress](https://developer.android.com/reference/java/net/InetAddress)objects.

<br />

|                                                                                    Parameters                                                                                     ||
|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dnsServers` | `Collection`: The[Collection](https://developer.android.com/reference/java/util/Collection)of DNS servers to set in this object. This value cannot be`null`. <br /> |

### setDomains

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setDomains (String domains)
```

Sets the DNS domain search path used on this link.

<br />

|                                                                                                           Parameters                                                                                                            ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `domains` | `String`: A[String](https://developer.android.com/reference/java/lang/String)listing in priority order the comma separated domains to search when resolving host names on this link. This value may be`null`. <br /> |

### setHttpProxy

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setHttpProxy (ProxyInfo proxy)
```

Sets the recommended[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)to use on this link, or`null`for none. Note that Http Proxies are only a hint - the system recommends their use, but it does not enforce it and applications may ignore them.

<br />

|                                                                                  Parameters                                                                                   ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `proxy` | `ProxyInfo`: A[ProxyInfo](https://developer.android.com/reference/android/net/ProxyInfo)defining the HTTP Proxy to use on this link. This value may be`null`. <br /> |

### setInterfaceName

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setInterfaceName (String iface)
```

Sets the interface name for this link. All[RouteInfo](https://developer.android.com/reference/android/net/RouteInfo)already set for this will have their interface changed to match this new value.

<br />

|                                                Parameters                                                ||
|---------|-------------------------------------------------------------------------------------------------|
| `iface` | `String`: The name of the network interface used for this link. This value may be`null`. <br /> |

### setLinkAddresses

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setLinkAddresses (Collection<LinkAddress> addresses)
```

Replaces the[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)in this`LinkProperties`with the given[Collection](https://developer.android.com/reference/java/util/Collection)of[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress).

<br />

|                                                                                                                    Parameters                                                                                                                     ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `addresses` | `Collection`: The[Collection](https://developer.android.com/reference/java/util/Collection)of[LinkAddress](https://developer.android.com/reference/android/net/LinkAddress)to set in this object. This value cannot be`null`. <br /> |

### setMtu

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setMtu (int mtu)
```

Sets the Maximum Transmission Unit size to use on this link. This should not be used unless the system default (1500) is incorrect. Values less than 68 or greater than 10000 will be ignored.

<br />

|                     Parameters                     ||
|-------|---------------------------------------------|
| `mtu` | `int`: The MTU to use for this link. <br /> |

### setNat64Prefix

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setNat64Prefix (IpPrefix prefix)
```

Sets the NAT64 prefix in use on this link. Currently, only 96-bit prefixes (i.e., where the 32-bit IPv4 address is at the end of the 128-bit IPv6 address) are supported or`null`for no prefix.

<br />

|                               Parameters                                ||
|----------|---------------------------------------------------------------|
| `prefix` | `IpPrefix`: the NAT64 prefix. This value may be`null`. <br /> |

### toString

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Returns a string representation of the object.

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string representation of the object. <br /> |

### writeToParcel

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Implement the Parcelable interface.

<br />

|                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | `Parcel`: The Parcel in which the object should be written. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                 |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE). Value is either`0`or a combination of[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES <br /> |