An appliance has 2 interfaces. Would like to export syslog information using a particular interface ip address.
How to configure this in /etc/rsyslog.conf?
An appliance has 2 interfaces. Would like to export syslog information using a particular interface ip address.
How to configure this in /etc/rsyslog.conf?
Here the way I have it in rsyslog.conf.
*.* @[ip address]:[optional port number]
[ip address] can be a hostname or an IP.
port number is optional. Omit the : if you are not using it.
Here is the way to set-up the route.
You need:
The CIDR of the IP Range to route. Ex 192.168.30.0/24
The IP Address to route to. Ex 192.168.30.250
The interface name of the network card with the IP address from above. Ex en0p2.
I'm on Redhat and the ifcfg files are in /etc/sysconfig/network-scripts. Not sure where yours may be.
cd /etc/sysconfig/network-scripts
create a file called route-[interface name] -or- route6-[interface name] for IPv6.
touch route-en0p2
Note: It is best to have the filename match the name of the ifcfg file. Such as: ifcfg-en0p2 and route-en0p2 -or- ifcfg-alternate_interface-en0p2 and route-alternate_interface-en0p2.
This isn't really required, but it makes it easier for the next gut who has to maintain the system. /rant
Add the routing information to this file:
[CIDR] via [nic-ip] dev [interface name]
192.168.30.0/24 via 192.168.30.250 dev en0p2
Bring down the interface, then bring it back up:
ifdown en0p2
I like to wait a bit here. Many will argue it is not necessary. I do it any way -- just incase there was a long-running process I won't have to try it again. Personally, I sing the magical Sys-Admin song.
What? You don't have one? Need to work on that. :D
ifup en0p2
Now, I can view my routes:
netstat -rn
(Yes, there are other ways to view the rout. Use what ever command you want.)
When the machine boots up, it will automatically read the route file and se it up for you.
Pro tip: Yes, you can add the route without cycling the interface. I do it this way to be sure there are no 'gotchas' anywhere. IF there is an error, I'll see it when I bring the interface up and can fic it, instead of getting called in the middle of the night. /rant