---
# System prepended metadata

title: 獲得出去路由的本地IP地址
tags: [linux, script]

---

# 獲得出去路由的本地IP地址
###### tag: `scrpit`, `linux`

``` bash
ip=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
echo $ip
```