> For the complete documentation index, see [llms.txt](https://notes.cavementech.com/pentesting-quick-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.cavementech.com/pentesting-quick-reference/metasploit-and-meterpreter/pivoting-on-metasploit.md).

# Pivoting on Metasploit

Check the IP address of the compromised machine in meterpreter

```
shell
ip addr
```

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2F2dTJxH1gYe4Jch3xzGCG%2Fimage.png?alt=media&amp;token=a7f69fcd-29b4-4599-adf1-662421931b2d" alt=""><figcaption></figcaption></figure>

We have another network interface.

Now we can add it to meterpreter route.

```
run autoroute -s 192.6.101.2
```

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FkHxfsdb6NX08IWmhxktL%2Fimage.png?alt=media&amp;token=a2c70f66-ae1f-4eb6-9d4c-7393a4a1a9ba" alt=""><figcaption></figcaption></figure>

Background the current meterpreter session and use the portscan tcp module of Metasploit to scan the second target machine.

Press CTRL+z and Enter y to background the meterpreter session.

```
use auxiliary/scanner/portscan/tcp
set RHOSTS 192.180.108.3
set verbose false
set ports 1-1000
exploit
```

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FK8q85H1VtYIXd4w3BPqC%2Fimage.png?alt=media&amp;token=dc551d3e-fe22-434f-a0a2-c69f38452485" alt=""><figcaption></figcaption></figure>
