lunedì 12 dicembre 2016

Ubuntu Multiple interfaces on the same subnet

7 down vote accepted

OK, it is working, and for referencing here is how I did it, hopefully someone will find it useful.
I found the solution on the following sites:
1- Multiple interfaces on the same subnet 2- Two network interfaces and two IP addresses on the same subnet in Linux
And the website that i referenced in the question as well.
suppose I have two IP addresses: 7.7.7.4 & 7.7.7.5 on network 7.7.7.0 and they have a gateway 7.7.7.1
I enabled ARP filtering:
# sysctl -w net.ipv4.conf.all.arp_filter=1
# echo "net.ipv4.conf.all.arp_filter = 1" >> /etc/sysctl.conf
And the I configured /etc/network/interfaces as following:
    # The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
   address 7.7.7.4
   network 7.7.7.0
   netmask 255.255.255.0
   broadcast 7.7.7.255
   up ip route add 7.7.7.0/24 dev eth0 src 7.7.7.4 table eth0table
   up ip route add default via 7.7.7.1 dev eth0 table eth0table
   up ip rule add from 7.7.7.4 table eth0table
   up ip route add 7.7.7.0/24 dev eth0 src 7.7.7.4

auto eth1
iface eth1 inet static
   address 7.7.7.5
   network 7.7.7.0
   netmask 255.255.255.0
   broadcast 7.7.7.255
   up ip route add 7.7.7.0/24 dev eth1 src 7.7.7.5 table eth1table
   up ip route add default via 7.7.7.1 dev eth1 table eth1table
   up ip rule add from 7.7.7.5 table eth1table
   up ip route add default via 7.7.7.1 dev eth1
   up ip route add 7.7.7.0/24 dev eth1 src 7.7.7.5
And I added the following two lines to /etc/iproute2/rt_tables
10 eth0table
20 eth1table

martedì 25 ottobre 2016

Linux changing Nice cpu priority to process

Finding the current niceness value

Before we start changing niceness values I want to go over identifying what the current nice values are.

Determining the default niceness value of new processes

Different OS distributions can have different default values for new processes. The simplest method to determine the default value is to simply run the nice command with no arguments. By default nice will simply return the current niceness value.
Example:
$ nice
0

In this example we see the niceness value of 0 is the default.

Determining the niceness value of a current process

The niceness value of current processes are also pretty simple to find as they are visible in the ps command's long format.
In the below example we are going to find the current niceness value of the sshd (PID 941) process.
$ ps -lp 941
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 941 1 0 70 -10 - 1713 poll_s ? 00:00:00 sshd

Just in case the formatting of this post doesn't make it easy to see, the column NI is the niceness value of the sshd process. In this case it is currently set to -10.

Making a process nicer, decreasing the CPU Priority

Niceness values range from -20 (the highest priority, lowest niceness) and 19 (the lowest priority, highest niceness). In order to prevent a process from stealing CPU time from high priority processes, we will increase the processes niceness value.

Changing the nice value of a new process

Changing the niceness value of a new process is fairly simple. The nice command itself will run the supplied command with the desired niceness value.
Example:
$ nice -n 19 ./test.sh 
My niceness value is 19

This method is helpful for CPU intensive processes that are not as time sensitive as other processes running on the system. By increasing the niceness value, we allow other processes on the system to be scheduled more frequently. I do want to highlight again that while this value is adjustable it can be ignored by the kernel's scheduler in Linux implementations.

Changing the nice value of a running process

To change the niceness value of a running process we will utilize the renice command. The usage is similar to nice however rather than supplying a command to run we will be supplying a process id.
In this example we will be adjusting the priority of the sshd process I showed above.
# renice -n 10 -p 941
941 (process ID) old priority -10, new priority 10

It is important to note that only the root user can modify the niceness value of other users processes. However a regular unprivileged user can adjust the niceness value to a "nicer" value on processes owned by that user.

Making a process less nice, increasing CPU priority

Now that we have adjusted processes to becoming nicer to the system, let us make a process that is less nice. By changing the priority of a process to a negative number, we are suggesting to the scheduler that it should provide higher priority to the specified process.

Changing the nice value of a new process

The method of changing a process to be less nice is the same as making a process nicer.
Example:
# nice -n -20 ./test.sh 
My niceness value is -20

Changing the nice value of a running process

To change the niceness of a running process to a negative value we will use the renice command again.
# renice -n -10 -p 941
941 (process ID) old priority 10, new priority -10

It is important to note that changing a processes niceness value to a negative value requires root privileges. As the effects of giving a process a higher priority could have detrimental effects on a system.
It is advisable to reserve setting niceness values to -20 only when absolutely necessary; as this would suggest to the kernel scheduler that the specified process has the same CPU priority as kernel worker threads.

giovedì 20 ottobre 2016

If you mess up your ubuntu box with Ati drivers

Have you tried removing the aticonfig?
sudo aticonfig --uninstall
If it persists..
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*
sudo rm /etc/X11/xorg.conf
sudo apt-get install --reinstall xserver-xorg-core xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri libgl1-mesa-glx:i386 libgl1-mesa-dri:i386
sudo dpkg-reconfigure xserver-xorg
sudo shutdown -r now