> For the complete documentation index, see [llms.txt](https://prosbcdocs.telcobridges.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prosbcdocs.telcobridges.com/tmedia-documentation/platforms-and-hardware/tmg-snmp-support.md).

# TMG SNMP support

**IMPORTANT:** Do not use this procedure with systems running version 2.6 and up. Follow these steps instead: [Configuring SNMP](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/api/snmp/README.md#related-tasks)

This page explains how to relay the SNMPv1 Mibs from the internal Telco portion of a TMG800/3200 out to the management interface.

This article explains how to configure `iptables` in order to seamlessly forward [SNMP](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/api/snmp/README.md) traffic from the TMG's management interface to the adapter and the other way around. This allows an external equipment to request SNMP information from the adapter by querying the TMG management interface's IP address.

In order to achieve most of the instructions in this article, you will need to login as `root` on your TMG (or an account with superuser privileges).

### Requirements

The release installed on the target system must be one of the following:

* 2.3.36 RC1 or later 2.3.x releases
* 2.4.28 RC1 or later 2.4.x releases
* 2.5.10 RC1 or later 2.5.x releases

The target unit is a TMG800 or TMG3200. See [TMG7800 SNMP support](https://telcobridges.com/media-gateways/products/tmedia-gateways/tmg7800/) for TMG5800/TMG7800 Your license must allow the use of SNMP on the adapter.

### Collect information about your TMG

In order to setup `iptables` correctly, the following information is needed:

1. The IP address of the TMG's management interface (can be obtained using `ifconfig eth0`). If you are using DHCP, it is not needed.
2. The IP addresses of both the Linux host and the adapter on the internal interface:
3. The host IP address can be obtained using `ifconfig eth1`.
4. The adapter *host* IP address can be obtained by opening a shell to the adapter and using `print_net`.

A typical TMG setup will have the following configuration. This configuration will be used in the following instructions; replace the corresponding settings with your own.

* Management interface IP: `DHCP`
* Internal Linux IP: `172.31.1.2`
* Internal adapter IP: `172.31.1.1`

### Installing net-snmp-utils (optional)

To know if `net-snmp-utils` is already installed, invoke `snmpget` on the command line of your TMG Linux host. The `snmpget` tool is used on the TMG to verify if the SNMP feature is available and working from the adapter.

1. If your management interface has direct Internet access, install `net-snmp-utils`: \`\`

```
yum install net-snmp-utils
```

If your TMG is not connected to the Internet and TBLinux is used, the `net-snmp-libs-5.4.2.1-2.tb1.ppc.rpm` and `net-snmp-utils-5.4.2.1-2.tb1.ppc.rpm` packages must be downloaded from <http://download.distribution.telcobridges.com/TBLinux/updates/1/os/net-snmp-libs-5.4.2.1-2.tb1.ppc.rpm> <http://download.distribution.telcobridges.com/TBLinux/updates/1/os/net-snmp-utils-5.4.2.1-2.tb1.ppc.rpm>

uploaded to the TMG and installed using \`\`

```
yum localinstall net-snmp-libs-5.4.2.1-2.tb1.ppc.rpm net-snmp-utils-5.4.2.1-2.tb1.ppc.rpm
```

&#x20;    2\. Test SNMP: \`\`

```
snmpget -d -v 1 -c public 172.31.1.1 SNMPv2-MIB::sysUpTime.0
```

If this command does not work, check the Web portal to see if the unit has the SNMP license

```
Status -&gt; Adapters -&gt; Licensed Features -&gt; search for SNMP
```

If it does not appear, contact TelcoBridges support group

### Enabling IP forwarding

To enable IP forwarding permanently on the TMG, edit the `/etc/sysctl.conf` file and set the `net.ipv4.ip_forward` element to `1`. For example:

```
[root@TB006009 ~]# vi /etc/sysctl.conf

...
```

1. Controls IP packet forwarding net.ipv4.ip\_forward = 1

**NOTE**: A reboot is required to activate this setting. It is possible to enable it immediately by setting the contents of `/proc/sys/net/ipv4/ip_forward` to `1`. For example: \`\`

```
echo 1 &gt; /proc/sys/net/ipv4/ip_forward
```

### Installing iptables

To know if iptables is installed on your system, you may just invoke it on the command line (type `iptables`). If it is not installed:

* If the management interface has an Internet connection, use

```
yum install iptables
```

* If no Internet connection is available and TBLinux is used, the `iptables-1.4.1.1-1.tb1.ppc.rpm` package must be downloaded from [the TBLinux distribution packages site](http://download.distribution.telcobridges.com/TBLinux/updates/1/os/), uploaded to the TMG and installed using \`\`

```
yum localinstall iptables-1.4.1.1-1.tb1.ppc.rpm
```

After installing `iptables`, you may see that no rules are set yet by using:

```
iptables -v -L
```

### Configuring iptables

Input the following lines at the command line:

```
iptables -t nat -A PREROUTING -p udp -i eth0 --dport 161 -j DNAT --to-destination 172.31.1.1
iptables -t nat -A POSTROUTING -p udp -o eth1 --dport 161 -j MASQUERADE
```

**OR** input the following lines if you are not using DHCP and want to use SNAT instead of MASQUERADE:

```
iptables -t nat -A PREROUTING -p udp -i eth0 --dport 161 -j DNAT --to-destination 172.31.1.1
iptables -t nat -A POSTROUTING -p udp -o eth1 --dport 161 -j SNAT --to-source 172.31.1.2
```

Consult the added rules by using \`\`

```
iptables -t nat -n -L
```

Permanently save the rules by using

```
service iptables save
```

If everything worked, SNMP requests should be answered from the TMG's management interface.

### References

* [Wikipedia's iptables article](http://en.wikipedia.org/wiki/Iptables)
* [Official iptables website](http://www.netfilter.org/)
* `man iptables`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://prosbcdocs.telcobridges.com/tmedia-documentation/platforms-and-hardware/tmg-snmp-support.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
