i've been looking for a solution for this for a while, hope you can help me.
I have a network at home like this.
+----------+
| INTERNET |
+-----+----+
|
+-----+----+
| CABLE |
| MODEM |
+-----+----+
|
+----------+---------+
| |
| |
+-----v-----+ +-----v-----+
+--------+ D-LINK | | D-LINK |
| | DIR-600 | | DI-524 |
| +-----------+ +-----+-----+
| | |
| | |
+ +-----+-----+ |
192.168.2.XXX---> Windows7 | |
+ | | |
| +-----------+ |
+ |Ubuntu | |
192.168.2.YYY +->Virtualbox <---Public IP ++
+-----------+
One Cable Modem with a Router (Dir-600) for local IPs, and an Access Point (DI-524) for public IPs.
On the local network i have a computer with Windows 7 and Virtualbox, In the virtualbox I have an Ubuntu 14.04 server. This server has internet conection on ETH0 with a bridged adapter, so it has a local IP like 192.168.2.XXX.
Also on the virtualbox i have set a wlan adapter with direct access to the virtual ubuntu server and connected to the DI-524 network with a public IP.
So, the ubuntu server has 2 interfaces:
ETH0 connected to local network with IP 192.168.2.XXX
WLAN1 connected to DI-524 with public IP.
What I want is:
Give WLAN1 the highest priority for internet access. And only if there is no WLAN connection, the virtual machine can access internet through ETH0.
I know it can be done changing metrics, but don't know how, i've tried many commands but nothing seems to work.
Can anybody help me?
Thanks in advance!
yes you can do that via ifmetric package install it on ubuntu then set number for example 10 to wlan0 and number 20 for eth0 it mean the highest priority number for wlan0 highest priority is 0 by default (priority denotes metric) check this topic enter link description here
but plz check your metric first via
route -n
then you can delete old metrics via something like this command
sudo route del -net default gw 192.168.2.XX netmask 0.0.0.0 dev wlan0 metric 0
Related
Colleagues,
I can't get working forwarding of redirected (externally) packets through Linux host. There is network model I'm experimenting with:
+----+(enp2) +----+ +----+
| H2 +---------+ o- +---+ H3 | (192.0.2.153)
+--+-+ | br | +----+
|(enp1) +-+--+
| |
| |
| |
+-------+--------+ +-+--+
| ovs i-br +--+ R1 |
+-------+--------+ +----+
|
|
+--+-+
| H1 | (10.9.8.100)
+----+
for traffic from H1 to H3 there is regular routing exists (through R1), but for some reasons I need to divert some kinds of the traffic through H2, using OVS rules for this. After I've added the rule:
ovs-ofctl add-flow i-br dl_type=0x0800,in_port=1,nw_proto=6,tp_dst=80,actions=output:4
I'm seeing incoming packets on enp1#H2:
15:21:51.596752 IP (tos 0x0, ttl 64, id 48926, offset 0, flags [DF], proto TCP (6), length 60)
10.9.8.100.44444 > 192.0.2.153.http: Flags [S], cksum 0x5f93 (correct), seq 774826047, win 64860, options [mss 1410,sackOK,TS val 3466298181 ecr 0,nop,wscale 7], length 0
While forwarding on H2 is allowed (net.ipv4.ip_forward=1), rpf switched off (net.ipv4.conf.(default|all).rp_filter=0), pings from H2 to both sides are working, iptables FORWARD accepts everything and routing is configured:
10.9.8.0/24 dev enp1s0 proto kernel scope link src 10.9.8.135
192.0.2.0/24 dev enp2s0 proto kernel scope link src 192.0.2.135
I don't see these packets on egress on enp2#H2.
Any ideas why this can happen and what to troubleshoot in order to find the cause?
Thank you.
Solved. It is required to rewrite dst MAC address on OVS as well, so rule must be:
ovs-ofctl add-flow i-br dl_type=0x0800,in_port=1,nw_proto=6,tp_dst=80,actions=mod_dl_dst:xx:xx:xx:xx:xx:xx,output:4
where xx:xx:xx:xx:xx:xx is H2's mac address. This is because H1, when forming ethernet header of outgoing packet, set R1's dst mac (according to H1's routing table). After being redirected on OVS, this packet comes to H2 and the latter ignores it since it's destined to another host.
I heard that there are types of ip addresses like primary address etc. and tried to get the ip address using the below command
ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
and got the result as below
192.168.122.1
192.168.168.1
172.16.142.1
192.168.1.102
so from the above can someone answer which my primary address is?
There is no such things as "primary address" or "primary device". You have multiple ip addresses related to multiple networt devices.
You could find out what devices allows you to access to the internet and finds its local ip.
To do that, issue the command route. It will output something like
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.254 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Now all you need is to use the device on the line default and use it in this command:
ifconfig <DEVICENAME> | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'
When a machine has different IP addresses, it is impossible to define the primary IP from a network only point of view. But a machine normaly has a name that can be obtained by the command uname -n, or by the POSIX function uname. Once you have that name, you can find the IP address corresponding to it by the getent command or the gethostbyname function: what is called the primary IP address is the first address returned.
So here you could use:
getent hosts $(uname -n) | head -1 | cut -f 1 -w
Primary address depends on your usage, there is nothing as such at the network level. If you use one IP to access your server usually, you may call it primary and the network devices won't know the difference.
What operating systems does Amazon RDS use. While I understand that when using RDS we are just exposed to a endpoint and internally the database we use might be supported by multiple systems, I would like to know what is the OS used by those systems.
To check the underlying operating of your MySQL DB instance on AWS RDS, you can use the following command:
mysql> SHOW variables LIKE '%version%';
Result:
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.6.39 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.39-log |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+------------------------------+
7 rows in set (0.01 sec)
Those systems are running under the Amazon Linux Distribution
I think this is a greping problem rather than a networking one:
My computer uses to have multiple ppp connections running at the same time, sometimes 0, sometimes 1, 2... etc.
For example, before connecting:
$ ifconfig | grep "ppp"
ppp0 Link encap:Point-to-Point Protocol
ppp1 Link encap:Point-to-Point Protocol
And, after connecting a new one:
$ ifconfig | grep "ppp"
ppp0 Link encap:Point-to-Point Protocol
ppp1 Link encap:Point-to-Point Protocol
ppp2 Link encap:Point-to-Point Protocol
How could I programmatically guess the ppp device (ppp2 in this example) just created?
EDIT-1: This could be another possible before connecting case:
$ ifconfig | grep "ppp"
$
(No ppp devices active)
EDIT-2: This could be another possible before connecting case:
$ ifconfig | grep "ppp"
ppp0 Link encap:Point-to-Point Protocol
ppp2 Link encap:Point-to-Point Protocol
A "hole" at ppp1: it does not exist, so the new ppp status after connecting will be:
$ ifconfig | grep "ppp"
ppp0 Link encap:Point-to-Point Protocol
ppp1 Link encap:Point-to-Point Protocol
ppp2 Link encap:Point-to-Point Protocol
I think the ppp devices behave that way.
I have a relatively high traffic linux/apache webserver running Wordpress (oh the headaches). I think our developer configured the memcache settings incorrectly because when I run this command to look at all incoming httpd connections.
sudo netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
I get:
1 68.106.x.x
1 74.125.x.x
1 74.125.x.x
1 74.125.x.x
1 74.125.x.x
15 0.0.0.0
70 173.0.x.x
194 127.0.0.1
...I see that I have 194 connections from 127.0.0.1, and VERY few from actual public IP's. looking at netstat further I can see those are going to port 11211 (memcache). Even if I restart httpd, it only takes a few seconds for the open memcached connections from 127.0.0.1 to skyrocket up again and almost immediately we are pushing our max httpd process limit (currently MaxClients = 105).
Here are the details for those connections:
tcp 0 0 127.0.0.1:26210 127.0.0.1:11211 ESTABLISHED -
cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""