Pick a color scheme
ad placeholder image ad placeholder image

Mobile IP: How Mobile Devices Get IP Addresses

Mobile devices constantly move between networks, yet maintain seamless connectivity. Understanding how mobile devices obtain and manage IP addresses is essential in our increasingly mobile world. This comprehensive guide explains mobile IP addressing, cellular networks, WiFi transitions, and the technologies that enable continuous connectivity.

How Mobile Devices Get IP Addresses

Cellular Networks

Mobile carrier network:

Device connects: To cell tower
Network: Assigns IP address
Method: Carrier-grade NAT (CGNAT)
IP type: Usually private or shared public
Duration: While connected to network

IP assignment process:

1. Device powers on
2. Registers with cell tower
3. Authenticates with carrier
4. DHCP assigns IP address
5. Device can communicate
6. IP may change when moving between towers

Carrier-Grade NAT (CGNAT):

Problem: IPv4 address exhaustion
Solution: Share public IPs among many users
Your device: Private IP (e.g., 100.64.0.1)
Carrier NAT: Translates to public IP
Public IP: Shared with hundreds/thousands of users

Learn more about CGNAT, NAT, and IPv4 exhaustion.

Example:

Your phone: 100.64.123.45 (private, RFC 6598)
Carrier NAT: 203.0.113.1 (public, shared)
Website sees: 203.0.113.1
Actual users: 1000+ devices behind same public IP

WiFi Networks

Home/office WiFi:

Device connects: To WiFi access point
Router: Runs DHCP server
IP assigned: Private IP (192.168.x.x, 10.x.x.x)
Internet access: Through router NAT
Gateway: Router's public IP

Public WiFi:

Coffee shop, airport, hotel
DHCP: Assigns IP from local pool
Captive portal: May require login
IP type: Private, behind NAT
Security: Use VPN on public WiFi

WiFi IP assignment:

1. Device connects to WiFi
2. Sends DHCP discover
3. Router offers IP address
4. Device requests IP
5. Router acknowledges
6. Device configured with IP, gateway, DNS

Switching Between Networks

Cellular to WiFi:

1. Device detects WiFi
2. Connects to WiFi
3. Obtains new IP address (WiFi network)
4. Cellular connection maintained (background)
5. Data traffic switches to WiFi
6. Cellular IP may be released or kept

WiFi to cellular:

1. WiFi signal lost or disconnected
2. Device switches to cellular
3. Uses existing cellular IP or obtains new one
4. Seamless transition (for most apps)
5. Active connections may drop

Dual connectivity:

Modern devices: Both WiFi and cellular active
WiFi: Primary for data
Cellular: Backup and voice
Seamless: Automatic switching

Mobile IP Technologies

Mobile IP (RFC 5944)

Purpose:

Maintain same IP address while moving
Roaming: Between different networks
Transparency: Applications don't notice
Use: Enterprise, IoT, specialized applications

How it works:

Home network: Original network
Home address: Permanent IP address
Foreign network: Visited network
Care-of address: Temporary IP in foreign network
Home agent: Router in home network
Foreign agent: Router in foreign network

Mobile IP process:

1. Device moves to foreign network
2. Obtains care-of address
3. Registers with home agent
4. Home agent creates tunnel
5. Traffic to home address → tunneled to care-of address
6. Device receives traffic at new location
7. Maintains same home address

Example:

Home network: 192.168.1.0/24
Home address: 192.168.1.100 (permanent)
Travel to: Foreign network
Care-of address: 10.0.5.50 (temporary)
Home agent: Tunnels traffic from 192.168.1.100 to 10.0.5.50
Applications: Still use 192.168.1.100

Limitations:

Complexity: Requires infrastructure
Overhead: Tunneling adds latency
Adoption: Limited in practice
Alternative: Modern approaches (below)

Cellular Network Mobility

Handoff/handover:

Moving between cell towers
IP address: May change or stay same
Connection: Maintained during handoff
Seamless: For voice and data

Types of handoff:

Hard handoff: Break-before-make
- Disconnect from tower A
- Connect to tower B
- Brief interruption

Soft handoff: Make-before-break
- Connect to tower B
- Maintain tower A
- Seamless transition
- Disconnect tower A

IP address persistence:

Same carrier network: IP often stays same
Different carrier: New IP address
Roaming: New IP from visited network
Session: TCP connections may survive

WiFi Roaming (802.11r)

Fast BSS Transition:

Purpose: Quick handoff between access points
Standard: 802.11r
Benefit: Seamless roaming
Use: Enterprise WiFi, mesh networks

How it works:

1. Device moves between APs
2. Pre-authentication with new AP
3. Fast handoff (<50ms)
4. IP address maintained
5. No DHCP renewal needed
6. Active connections continue

Requirements:

Access points: Support 802.11r
Same network: Same SSID and subnet
Controller: Centralized management
Configuration: Proper setup

IPv6 and Mobile Devices

IPv6 Benefits for Mobile

Abundant addresses:

IPv4: Shared via CGNAT
IPv6: Every device gets unique address
End-to-end: Direct connectivity
No NAT: Simplified networking

Mobile IPv6 (MIPv6):

Improvement: Over Mobile IPv4
Built-in: IPv6 designed with mobility
Routing: Route optimization
Efficiency: Less overhead

How MIPv6 works:

Home address: Permanent IPv6 address
Care-of address: Current location address
Binding update: Inform correspondents
Direct routing: After binding update
No tunneling: More efficient than MIPv4

Carrier IPv6 Deployment

Mobile carriers:

T-Mobile: IPv6 deployed
Verizon: IPv6 available
AT&T: IPv6 rolling out
Sprint: IPv6 deployed
Global: Increasing adoption

Dual-stack:

IPv4: Via CGNAT
IPv6: Native, unique address
Preference: IPv6 when available
Fallback: IPv4 for legacy

464XLAT:

Purpose: IPv4 apps on IPv6-only network
CLAT: Customer-side translator
PLAT: Provider-side translator
Result: IPv4 apps work on IPv6 network
Transparent: To applications

Mobile Network Architecture

4G LTE

Network components:

eNodeB: Cell tower/base station
MME: Mobility Management Entity
S-GW: Serving Gateway
P-GW: PDN Gateway
HSS: Home Subscriber Server

IP assignment:

1. Device attaches to eNodeB
2. MME authenticates device
3. P-GW assigns IP address
4. IP address from carrier pool
5. Device can communicate

IP address types:

IPv4: Via CGNAT (100.64.0.0/10)
IPv6: Unique /64 prefix
Dual-stack: Both IPv4 and IPv6

5G

Network slicing:

Concept: Virtual networks on same infrastructure
Slices: Different for different use cases
IP addressing: Per slice
Flexibility: Customized per application

5G Core:

AMF: Access and Mobility Management
SMF: Session Management Function
UPF: User Plane Function
IP assignment: SMF coordinates with UPF

Improvements:

Faster: Lower latency
More addresses: IPv6 native
Flexibility: Network slicing
IoT: Massive device support

Mobile IP Address Characteristics

Dynamic Assignment

DHCP lease:

Duration: Hours to days
Renewal: Automatic
Change: IP may change on renewal
Persistence: Not guaranteed

When IP changes:

Device restart
Network reconnect
DHCP lease expiration
Moving between networks
Carrier maintenance

Impact:

Active connections: May drop
New connections: Use new IP
Applications: Should handle reconnection
Stateless: Preferred design

Private vs Public IPs

Cellular (CGNAT):

Your device: 100.64.x.x (private)
Carrier NAT: Translates to public
Public IP: Shared with many users
Ports: Dynamically allocated
Incoming: Difficult without setup

WiFi (home):

Your device: 192.168.x.x or 10.x.x.x (private)
Router NAT: Translates to public
Public IP: Shared with household
Port forwarding: Possible

Public IPv6:

Your device: 2001:db8::/64 (unique)
No NAT: Direct connectivity
Incoming: Possible (if firewall allows)
Privacy: Use privacy extensions

Geolocation

IP geolocation accuracy:

Cellular: City-level accuracy
WiFi: More accurate (if database has AP location)
GPS: Most accurate (not IP-based)
VPN: Shows VPN server location

Mobile considerations:

Moving: Location changes
Roaming: Different country IP
WiFi: Location of access point
Accuracy: Varies by method

Mobile-Specific Challenges

NAT Traversal

Problem:

Device behind CGNAT
Incoming connections: Difficult
P2P applications: Challenging
VoIP: May have issues

Solutions:

STUN: Session Traversal Utilities for NAT
TURN: Traversal Using Relays around NAT
ICE: Interactive Connectivity Establishment
UPnP: Universal Plug and Play (WiFi only)

Example (WebRTC):

1. Use STUN to discover public IP and port
2. Exchange candidates with peer
3. Try direct connection
4. Fall back to TURN relay if needed
5. Establish connection

Connection Stability

Mobile challenges:

Signal strength: Varies
Handoffs: Between towers
Network switching: WiFi ↔ cellular
IP changes: Connections drop

Application strategies:

Reconnection: Automatic retry
Exponential backoff: Avoid overwhelming
State preservation: Save progress
Heartbeats: Detect disconnection
Graceful degradation: Handle offline

Battery Optimization

Network impact:

Cellular: More power than WiFi
Weak signal: Drains battery faster
Constant polling: Battery drain
Background sync: Controlled by OS

Best practices:

WiFi preferred: When available
Batch requests: Reduce wake-ups
Push notifications: Instead of polling
Adaptive sync: Based on usage
Doze mode: Respect OS power management

Privacy and Security

Mobile IP Privacy

Tracking concerns:

IP address: Can track device
CGNAT: Shared IP reduces tracking
WiFi: MAC address tracking
Location: IP reveals approximate location

Privacy measures:

VPN: Hide real IP
Private relay: Apple's solution
MAC randomization: Different MAC per network
IPv6 privacy extensions: Temporary addresses

Security Considerations

Public WiFi risks:

Unencrypted: Traffic visible
Man-in-the-middle: Possible attacks
Fake hotspots: Phishing
Packet sniffing: Data theft

Protection:

VPN: Encrypt all traffic
HTTPS: For web browsing
Avoid: Sensitive transactions on public WiFi
Verify: Network authenticity
Firewall: Enable on device

Cellular security:

Encryption: Built into 4G/5G
Authentication: SIM card
Interception: Difficult (but possible with equipment)
IMSI catchers: Fake cell towers

Developer Considerations

Handling IP Changes

Best practices:

// Detect network change
window.addEventListener('online', () => {
  console.log('Network connected');
  reconnect();
});

window.addEventListener('offline', () => {
  console.log('Network disconnected');
  pauseOperations();
});

// Reconnection logic
function reconnect() {
  // Re-establish WebSocket
  // Refresh authentication
  // Resume operations
}

Mobile app (iOS):

// Monitor network changes
import Network

let monitor = NWPathMonitor()
monitor.pathUpdateHandler = { path in
    if path.status == .satisfied {
        print("Connected")
        reconnect()
    } else {
        print("Disconnected")
    }
}

Mobile app (Android):

// Network callback
ConnectivityManager.NetworkCallback callback = 
    new ConnectivityManager.NetworkCallback() {
    @Override
    public void onAvailable(Network network) {
        // Network available
        reconnect();
    }

    @Override
    public void onLost(Network network) {
        // Network lost
        pauseOperations();
    }
};

API Design

Stateless design:

Avoid: Server-side sessions tied to IP
Use: Token-based authentication (JWT)
Idempotent: Safe to retry requests
Resumable: Support resuming operations

Handle reconnection:

Automatic retry: With exponential backoff
Duplicate detection: Idempotency keys
State sync: Resume from last known state
Offline support: Queue operations

Future of Mobile IP

5G and Beyond

5G improvements:

Lower latency: <10ms
Higher bandwidth: Multi-gigabit
More devices: Massive IoT
Network slicing: Customized networks
IPv6: Native support

Edge computing:

MEC: Multi-access Edge Computing
Local processing: Reduce latency
IP addressing: Local edge servers
Use cases: AR/VR, gaming, IoT

IPv6 Adoption

Mobile-first:

Carriers: Leading IPv6 adoption
Devices: Full IPv6 support
Benefits: Unique addresses, no CGNAT
Future: IPv6-only networks

Transition:

Current: Dual-stack (IPv4 + IPv6)
Future: IPv6-only with 464XLAT
Eventually: Pure IPv6

Conclusion

Mobile devices obtain IP addresses through cellular networks (via CGNAT) or WiFi (via DHCP), with addresses changing as devices move between networks. Modern smartphones handle these transitions seamlessly, though applications should be designed to handle IP changes and reconnections. IPv6 adoption in mobile networks provides unique addresses and better end-to-end connectivity, while technologies like Mobile IP and 802.11r enable seamless roaming.


Related Articles

IP Assignment

IPv6 for Mobile

Network Concepts

Explore More

Key takeaways: - Cellular: IP via CGNAT, often shared - WiFi: IP via DHCP, private address - IP changes: When switching networks - CGNAT: Shares public IP among many users - IPv6: Unique address per device - Mobile IP: Maintains same IP while roaming - Handoff: Seamless between cell towers - 802.11r: Fast WiFi roaming - Security: Use VPN on public WiFi - Development: Handle IP changes gracefully - Future: 5G and IPv6 adoption - Privacy: Use privacy extensions, VPN

Mobile devices dynamically obtain IP addresses from cellular networks (via CGNAT with shared public IPs) or WiFi networks (via DHCP with private IPs). IP addresses change when switching between networks, so applications should handle reconnections gracefully. Use VPN on public WiFi for security, and design mobile applications to be stateless with automatic reconnection logic. IPv6 adoption in mobile networks provides unique addresses and eliminates CGNAT limitations, with carriers leading IPv6 deployment globally.

ad placeholder image ad placeholder image
Three funny piglies - an illustration ippigly.com