Change source IP to destination network MikroTiK - mikrotik

I need to create a Nat rule that if I request a network IP on a private network of 172.21.0.0 that my source IP becomes 172.21.2.33
So if dst = 172.21.x.x then src = 172.21.2.33
The router has a public IP and a private IP on port Etha0
I have this address added to Port Eth0
How can I write this rule in RouterOS?

Well i'm not sure about the mask (assuming /16) since you gave no info about it, but something like this may work:
/ip firewall nat
add action=src-nat chain=srcnat dst-address=172.21.0.0/16 to-addresses=172.21.2.33

Related

I need to block all but one IP address from access to Mongo running on my local Mac using packet filter

Could someone help me block all incoming traffic on my network which has port forwarding set up on the router to allow incoming requests on port 27017 to be sent to the Mac running Mongo internally except for one IP address which I can specify? I tried loading a new anchor file from /etc/pf.conf. In that file I've put the following:
rdr pass on lo0 inet proto udp from xxx.xxx.xxx.xxx to any port 27017 -> 127.0.0.1 port 27017
rdr pass on lo0 inet proto tcp from xxx.xxx.xxx.xxx to any port 27017 -> 172.0.0.1 port 27017
where xxx.xxx.xxx.xxx is the IP address I want to allow in. It does allow that address in, but I think I need to do something else to block all others. The documentation of this stuff is very dense. Any help would be appreciated.

How to do JMeter ip spoofing on Mac?

Just try to figure out how to do ip spoofing in JMeter on my mac. What is done is that I created file which contains ip addresses somewhere in my subnetwork.
When I try to run thread JMeter shows me:
java.net.BindException: Can't assign requested address
Only my IP has ping. So, could you please advice me where I am wrong?
You can add an IP alias from Terminal application (it is under Applications -> Utilities) as
sudo ifconfig en0 alias 192.168.0.12 255.255.255.0
where:
en - is Network Interface name
192.168.0.12 - is the IP alias
Once you set up the alias, you can use new IP address in the "Source address" input
And HTTP requests will use that IP address as source one:
You can remove the IP alias when it is no longer required as
sudo ifconfig en0 -alias 192.168.0.12
See Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter guide for more detailed information on the domain.

How to tunnel host traffic through guest in Virtualbox using Vagrant

I have a Ubuntu host and an Ubuntu guest. I want to achieve that my host traffic is tunnelled through my guest. Thus enabling me to do analysis on the host traffic from the guest. I am assigning two interfaces to the guest (in addition to the built in NAT interface which is provided by Vagrant). I am creating a bridge interface on the host called br0. One of the guest interfaces is connected via bridging to eth0 (the host interface which is connected to the Internet) and the other guest interface is connected via bridging to the host br0 interface. On the host I am deleting my default gateway and adding a new one with:
route del default
route add default dev br0
After that I can vagrant ssh into my guest and set up a bridge interface there as well with.
brctl addbr br0
brctl addif br0 eth1
brctl addif br0 eth2
After this setup the host traffic should be routed through the guest. If I run
tcpdump -vni br0
inside the guest I can see packets but I can't connect to the Internet. There is something missing. Any ideas?
I had to enable IPv4 forwarding in the guest.
Edit /etc/sysctl.conf to enable forwarding permanently:
net.ipv4.ip_forward = 1
Run this to activate the setting without a reboot:
sysctl -p /etc/sysctl.conf

Assign static local ip address to OS inside virtual machine with bridged connection

I have win 7 OS on my laptop, and linux(debian 7) inside vmware. I have set the debian to have bridged connection with the network. I am connected by wifi, and if the wifi modem is being restarted the local ip address of the debian changes, e.g. from 192.168.0.106 to 192.168.0.102. Is there a way to set the local ip address, so it will always remain the same ?
Thanks
You have to change your /etc/network/interfaces like this
and after that remember to restart your service using
sudo service networking restart
ok, found the solution
here is the source
http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html
basically for debian
1) vim /etc/network/interfaces
2) comment/delete this line iface eth0 inet dhcp
3) add this
iface eth0 inet static
address 192.168.1.106 # this is the ip address you want to assign
netmask 255.255.255.0
network 192.168.1.0

How to specify outbound IP for specific applications on multiple venets?

I'm having problems with proxy/relay applications such as a BNC. I have a CentOS 5.6 VPS with 2 IP addresses which are virtual adapters (venet0:0 and venet0:1) under venet0.
In these applications I can choose which IP address to bind to (IP address of venet0:1) but when they create an outbound connection, it is done through venet0:0.
These are my current settings (found using webmin):
Interfaces
Name Type IP Address Netmask Status
lo Loopback 127.0.0.1 255.0.0.0 Up
Loopback ::1 128 Up
venet0 Unknown 127.0.0.1 255.255.255.255 Up
venet0:0 Unknown (Virtual) xxx.xxx.xxx.xxx 255.255.255.255 Up
venet0:1 Unknown (Virtual) xxx.xxx.xxx.yyy 255.255.255.255 Up
Route and Gateways
Destination Gateway Netmask Interface
169.254.0.0 None 255.255.0.0 venet0
Default Route None venet0
::1 :: 128 lo
Please can someone help me figure out how to configure the VPS?
Try to remove the default routes you do not want. The command ip route list should give you three entries. For example, on my Debian VPS, I get :
192.0.2.1 dev venet0 scope link
default via 192.0.2.1 dev venet0 src 10.15.4.62
default via 192.0.2.1 dev venet0 src 10.15.4.61
I want the VPS to use 10.15.4.61 for outgoing connections, not 10.15.4.62, so I type :
ip route del default via 192.0.2.1 dev venet0 src 10.15.4.62
Now I have a single default route, and my VPS will use the IP I want.

Resources