Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Syncronized Folders across Windows and Linux - (Cloud-)Free Encrypted Cross-Platform Synchronisation with Unison

Diposkan oleh Unknown on Sunday, August 15, 2010

I always wanted to sync a few folders of my system across all my computers. E.g. the my scripts directory, where I constantly fiddle with my scripts and create new ones, my documents I always want to be able to have and edit everywhere, etc. I would never know where the most current version is without bothersome comparison of the dates. I would have to check every file and then copy the newer one. But that's now history, thanks to unison and my sync scripts.

What you need
The biggest problem is that you need a Linux server somewhere that is best constantly running and connected. I sync all my files with an online server. This is not a big deal because with SSH the connection is securely encrypted. Also due to compression and the fact that files are only transferred once, sync is pretty fast even with an ADSL connection. Of course this won't work for slow dial up connections in combination with large files. But as long as there are only small changes in certain files, even dial up might work for you. A Linux server is not really needed, but makes the setup much easier, which is why that's what I demonstrate here. And of course if you only want to sync two computers with each other, then there's no need for a constantly active server. It should work with Mac as a client or even server, but I don't own one so I can't help with that.

Downloads
You can get your unison downloads for Mac, Windows here and for Linux here (Ubuntu binaries i386 for 9.10 and 10.04 and more in this ppa. I recommend version 2.40.16, read below for why.

For Windows you also need to get Putty Agent (Pagent), Putty Puttygen and Plink get them at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. For Linux you also need openssh-server ssh-agent, ssh-keygen (in the openssh-client package) and keychain. You need to setup a working ssh connection with public key authentication for this to work without your interaction in the background. See here how to do this.

Bugs in the past
At the time I found it, over a year ago, it was still pretty buggy. It couldn't handle unicode, special characters or Umlauts properly. Especially between different system you'd end up with two differently named versions of a file unless you restricted yourself to normal a-z characters - very annoying.

But recently new version has come out, which fixes the problem. Now unison is not only a tool to synchronize flawlessly across different systems, it's also faster and prettier "GUI" than older versions and it still synchronized across encrypted ssh connections if you want it to. In my view this makes it the perfect tool for my needs. I've set it up to synchronize my laptop and my netbook with each other and my server system over ssh.

How it works
It's blazingly fast by only copying those parts of the files that have changed. And it doesn't transfer any files to check this. It runs both on the server and the client and only transfers the dates and hash coddes of the files via a secure compressed ssh connection. You can find out more about unison at LinuxJournal.

The easiest setup and the one I will show here is a star topology setup. This means there are several client systems synchronizing with one server. It works because unison knows which files are newer. The great side effect is that you automatically have a distributed backup on all your systems - the server and all clients of all your files.

The script runs automatically every X minutes in the background via cron on Linux (completely invisible) and is called by the Windows Task Manager on Windows (almost invisible).

Important to know
You need to use exactly the same version on all system you deploy it. There are easy to install packages for Debian and Ubuntu and precompiled versions for Windows. I haven't worked with OS X version yet, but they should work as well. I use a Linux server, Windows on the server side should be possible to set up but it's going to be much more difficult. Setting up the client on Windows is already non-trivial.

As you don't modify the same file on both systems at the same time before a server sync, then there won't be any problems. If you do, unison will not sync them. You need to call unison by itself and it will prompt you to chose how to deal with the situation.

The Linux version uses the symlink feature of Linux to let you configure which folders to sync on the go. In Windows this won't work, so all your folders you want to sync need to be inside one parent folder. I know no way around this, though the unison config file might have a solution somewhere...

Sync script:
#!/bin/bash

LOG="tee -a $HOME/logs/mysync2.log"
source $HOME/scripts/functions $HOME/scripts/variables

main ()
{
echo Starting at $(date)

# exit if running on battery
grep on-line /proc/acpi/ac_adapter/*/state >> /dev/null
if [ ! $? ]; # 1 if not "on-line"
then
echo Running on battery. Leaving now...
exit 0;
else
echo Running on AC Adapter.
fi

# use ssh-agent
source $HOME/.keychain/*-sh 2>&1
echo sock $SSH_AUTH_SOCK pid $SSH_AGENT_PID me $(whoami)
ssh-add -l || (echo "SSH Key not active\!"; ssh-add || exit 1)

cd $HOME

unison-2.40.16 sync -batch -maxbackups 2 ${@} 2>&1

echo Exiting at $(date)
}

main | $LOG

It checks and exits when the system is running on battery. To be able to work in the background, it uses ssh-agent. So you need to setup ssh key authentication.

Unison config in ~/.unison/sync.prf:
# Unison preferences file
root = /home/user/sync
root = ssh://user@syncserver:port/syncfolder
follow = Path *
ignore = Path {scripts/s3.sh}

This is a sample config file. It follows all symlinks in the $HOME/sync folder to syncfolder on syncserver via ssh. The ignore section shows you how to exclude certain files from synchronization.

Windows Setup
This should already work just fine in Linux. Now let's turn to the Windows client.

The Window setup, as you will see, it much more "fun". There are several steps you need: Putty Agent (Pagent), Putty Puttygen and Plink (see above for links) and then a few bash scripts.

You need to copy your private ssh key from your linux box and convert it to putty's format with puttygen. Then copy it into a safe folder. I have it in the same folder as the Unison.exe. Then setup an ssh connection to your server with Putty that uses the key and save it to profile name unisonssh. Copy the following bash files to your unison folder and adjust the path names accordingly.

Putty Agent.bat:
pageant.exe sshkey.ppk
This needs to be a script or otherwise it's not started in the right folder and won't find the key. Try it with the full path of the key file then. This must be linked into Autostart if your and will prompt you for your ssh key password if your key is password protected.

SSH Connect.bat
@plink -C -ssh -load unisonssh -i "C:\unison\sshkey.ppk" -l djtm -P 22 unison -server -auto
Change the path to where your ssh key lies and the port to your server's port if necessary.

Unison Sync.bat
C:
cd "C:\unison\"
unison2.4.exe -sshcmd sshconnect.bat -backups -backupdir unisonbackups -backuplocation central -batch -confirmbigdeletes -contactquietly

Testing it
Now is a good chance to try everything works fine. Try creating a file one one system and see how after two syncs it magically appears on the other. Edit it there to see how the edits are transferred back to the first system.

Scheduling it
Once everything works you can schedule it to run regularly without you needing to do anything. In Linux, you should install keychain for this to work in scripts and then enter the following into your cron. (To edit your cron type crontab -e)
*/15 * * * * $HOME/scripts/unisonsync
The */15 means to sync every 15 minutes. Don't worry, usually nothing will be done - I hardly ever notice anything happening. Of course the path should be where your unison sync script lies.

In Windows it's a tad more difficult again. The most difficult part of it all is to make it run in the background without annyoing you every 15 minutes or so. The following command looks a bit quirky, but that's the best I could do. Enter exactly this behind Execute: in the task scheduler.
cmd /C start /LOW /MIN "Unison Sync" "C:\unison\unison.bat"
and "C:\unison" next to execute in. Check both execute only when logged in and, under the settings tab, not to start the task if you're running on battery.

And now - finally - enjoy great, free, in sync folders!

Another older, less detailed guide is available here and here. Thanks to the authors of Unison.
More about → Syncronized Folders across Windows and Linux - (Cloud-)Free Encrypted Cross-Platform Synchronisation with Unison

What Linux means for the Consumer - Drivers, Open Source and Support

Diposkan oleh Unknown on Monday, June 28, 2010

When a consumer installs a Linux system, this has various consequences for him, which are sometimes hard to estimate at first. I've written a little summary touching the differences to Windows and Mac OS X in drivers, open source and support.

Drivers
Linux is not yet as far spread as Operating Systems like Windows or Mac OS X. This means that hardware corporations which have little money or skilled staff usually don't publish their own Linux driver and ship it along with the hardware when you buy it. In short: There currently is usually no driver disk for Linux.

But that's not really as a big a problem as it seems at first. One point is that - especially if the poor or skill lacking company is smart and publishes detailed product specifications - drivers are often written by the community. This has the disadvantage that it takes longer and when a device is first release, there is not usually no driver ready yet.

But it also has several advantages: Once drivers are written, they are usually open source. For the advantages, see below in my next point. And the drivers eventually are often better and more extensive than the drivers delivered by the hardware manufacturer. E.g. the bttv drivers of my TV card worked much better and longer than their Windows counterparts. And there was even an additional driver not present in Windows for a sound chip on the TV card to digitalize TV and line input sound up to a rate of 192 Khz -- for a TV card produced in 199X! My current sound card - using the snd-hda-intel driver - for some reason has a significantly better sound in Linux than in Windows, where it pretty much lacks any bass.

A huge advantage is the common API of drivers. In Windows every manufacturer writes his own drivers with their own API, and their own software to use the API. E.g. A DVB-T digital TV card has a Windows driver, and a special decoding and recording software for each and every single card. Sometimes the main chip and driver comes from the same manufacturer for several cards. But it's still often difficult if possible at all to use another software than the one supplied by the manufacturer.

In Linux, there is a common DVB interface. This means you can not only use the same software for all DVB-T receivers, you can even often use the same for DVB-T(errestrial), DVB-S(atellite), and DVB-C(abel). And it makes perfect sense that instead of tens of quickly written (and often buggy) different applications for different cards, you have a selection of a few really good programs. (E.g. Tvtime and others for analog, Kaffeine and others for digital reception -- and I mean for all supported ones).

In Windows, if there is a new group of popular hardware, like WIFI or Digital TV adapters, you need to wait for Microsoft to release a common API and hope they do. That's likely to happen only in the next Windows Version (e.g. XP, Vista). And then everything must be backwards compatible. This means that a better API might not be introduced for Windows XP ever, and advantages for new APIs are restricted by the requirement that all old APIs have to still work exactly the way they did. With open source drivers in the kernel tree, you can just modify the drivers along with the API. It's all in the same place and some changes are simply a matter of "search and replace".

Once a good open source driver exists, and especially if it gets integrated into one of the main driver projects, it usually works out of the box. This means you start Linux, even from a Live CD, and the hardware, e.g. a sound card, scanner or TV card just immediatelly works without any fuss like driver installation or configuration. It's not like installing Windows and then downloading the drivers for all your software, but if the driver is well supported, it just all works after installing the sytem. That's why Live CDs are so useful to test the Linux compatibility of a computer's hardware. And another great thing is that these integrated drivers are automatically updated for you - for Ubuntu even without the need to reboot (for other distributions you need to pay for this feature). This prevents security risks, which are much more rare in Linux, anyway.

Open Source
Open Source is a guarantee that a good product can have a long life-time. Drivers are one excellent example. If you have an open source driver, and it's of good quality and integrated into the Linux kernel or one of the main user land driver projects (SANE, CUPS, ALSA), you will have a driver for a very, very long time. This means that unlike with Microsoft and Mac OS X systems, you will not need to buy a new scanner, because you can't find a driver for Windows 7 or the "Snow Leopard", but quite the contrary the driver usually gets better and better and you often have no problems whatsoever with using a 10 years or older scanner, printer, sound card, TV card, etc with the newest Windows version.

My DVB-T adapter has lots of features it lacks in Windows, including recording up to 4 channels in one bouquet at once, 50 fps deinterlacing, hardware accelerated video decoding, automatic scheduled recording, etc. I just got a new sound card, which uses a lot less CPU and doesn't have a few of the Windows issues like skipping and beeping during playback. Even the pretty new Intel poulsbo chipset already works better for me in Linux now than in Windows (lower battery consumption, better video scaling and hardware accelerated video playback, much faster resume from suspend (feels like 1 second max, dmesg says 2.5 seconds; Windows takes a felt 4-15 seconds), ...). Thanks to Linux my Netbook is now a full featured surround sound FullHD video center and it consumes even less battery than in Windows.

But open source also means that things are customizable. This would of course also mean that if you can program yourself you can potentially modify and fix as many issues with software and drivers as your skills permit. And this is one of the main driving forces of Open Source. But it also means that if there is a problem, the fix can be applied where it makes the most sense. Let's make another example in comparison to Windows.

In Windows if there is a bug in the suspend to ram mechanism, which causes problems for a certain hardware, this is quite hard to figure out in the first place. Because you don't know how the Windows mechanism works. If it was publicly known, Linux would have a much easier way with ensuring suspend to ram compatibility for more hardware. Once you figure out where the problem is in Windows, you still have no way of fixing the problem where it occurs.

Because you can't modify any Windows components. That's completely different in Linux - here anyone can modify anything. I once wrote a small Linux kernel patch myself, and I'm really not that much of a programmer. But with the help of some kernel developers I fixed my own problem and then posted my first Linux kernel patch.

Another great example is powertop. It's a tool to check what decreases your battery time in Linux by looking into which applications wake up your CPU from power saving modes and how often. For this to work the kernel had to be modified. Once this was done you could find out which programs are the main cause. And then, because they are also usually open source, you could modify them as well so they don't wake up the processor as often. And that's how my netbook now consumes less power - in some scenarious a lot less - in Linux than in Windows. All this would not be possible in a closed source world. The same is now done for latency with latencytop btw.

Support
The disadvantage with support in Linux and Open Source is that if you don't pay for it, you won't get people who will treat you like you paid for it. This means it's very un-wise to contact driver or other software developers and say: "You've got to fix this!" Because they really, really don't have to. They are in no way obligated to you. You should always remember that. Only some people get paid for their work for open source at all. Many start a project and keep working it to scrach and itch (see here, and here). And I think it's how Linus started the Linux kernel project sometime long ago. If you want support that treats you like you've paid for it - get paid support!

But the big advantage in Linux support is that if you have a clue, you have access to incredibly smart people. You can talk directly to the developers and they usually know their stuff really, really well. Yes it can be a problem to get an answer sometimes, but if you've read the manual, you really know what you're doing, keep in mind that you didn't pay them and appropriately contact them very politely, you will be amazed how much is possible.

I still remember how helpful, friendly and patient the KDE plasma developers were when I wrote my first plasma-applet. I remember how the Linux kernel developers take every issue seriously and try to help you find the problem, especially with regressions.

And in my view it's so incredibly much better than most hardware manufacturers who you pay with buying their products to get support. You usually first get stuck with incompetent telephone support and are really lucky if you ever get to contact the driver developers or someone anywhere near them. And then those driver developers usually get their money for writing bleeding edge new drivers for new hardware, or they need to write a driver that's compatible with the newest Windows release (without really knowing how everything works on the Windows side).

They usually have little patience and understanding for a not working driver in some system and say that your supplier should fix the issues. (E.g. NVIDIA would say the graphics card manufacturer should fix the problem and Intel would say your Notebook manufacturer should deal with the problems.) But open source developers will usually understand you well, because that's often why they wrote the driver in the first place, so as many people can use it without problems as possible. Here the problem is usually not the lack of will, but of your politeness, your and their time and other resources.

Conclusion
You have to ensure that hardware is Linux compatible before you buy it. If you're lucky and you find open source driver integrated into the Linux kernel or one of the main driver projects, you are most likely to be able to really enjoy your hardware in Linux for a very, very, very long time and there will be no need miss out on the newest features and software coming for free with the newest release of your favorite distribution. If something doesn't work you're expected to do your part and google and try everything you can to fix it, including postings in a forum and on a user mailing list before contacting the developers. This way they have more time for and fun with actually fixing the problem.

But it also means that for not paying for Windows and the drivers, you can't expect the same support. If you want the same level of support, try offering money to the developers you want the support from (paypal helps) or buy a support service. I'm sure they're much more likely to help you in a way similar or better than Windows then.

I'm happy about your thoughts and comments. And remember I don't get paid for writing this either - as you can't even see ads on this page.

All trademarks belong to their respective owners, not to me.
(Windows, Windows XP and Windows Vista->Microsoft, Mac OS X -> Apple, Linux to Linus Torvalds etc.).
More about → What Linux means for the Consumer - Drivers, Open Source and Support

Creative X-fi Surround USB Review and Guide for Ubuntu 9.10 or Newer

Diposkan oleh Unknown on Tuesday, June 1, 2010

This article will review the Creative X-fi surround usb first quickly in Windows XP and then in Linux. It will give you some basic performance ideas and hints for fixing problems and having more fun with it.

After my survey of the possibilities for USB surround sound in Linux, I ended up ordering a Creative X-fi Surround USB. As you could read there, there is a helpful webpage that includes e.g. ready made .asoundrc files.

Windows XP
On my netbook, without installing any special drivers, playing a song on an otherwise unoccupied Windows XP utilizes about 20% CPU, minus the almost 5 % that somehow seem to be there almost always...

I've read reports that there are clicking sounds, which I can imagine well with a heavy system load. I've heard them at first after plugging it in, but by now they disappeared. It sounds crisp on my Sennheiser headphones and the base is noticeably better than my onboard sound, obviously, but that doesn't say much.

Now let's see how it fares in Linux...

Reboot. Plug. Play. It could hardly be easier. All I had to do was to tell mplayer which device to use (mplayer -ao alsa:device=hw=S51). Then it happily started playing over my new external sound card. The sound is as excellent as under Windows. But better than Windows: Surround sound works out of the box in my Kubuntu 9.10 system.

The combination of AC-3 surround with VAAPI accelerated 720p movie on my netbook utilizes around 10-12 % CPU. There is no stuttering in Linux, even with heavier load. Just playing music hardly seems to have any impact -- maybe around 5 % CPU. I'll have to let the Phoronix suite benchmark all this sometime. In Windows even just playing music in VLC and increasing the volume setting with the knob on the device can create stutters.

Right now for some reason the slightly dusty Chromium version on this netbook keeps bringing the system into a hard stutter making characters appear slowly on the screen up to a second after I type and the mouse does not move smoothly. But the sound plays smoothly in the background. Just plain wonderful.

Resume

I can definitely recommend the sound card for USB (surround or stereo) sound in Linux. I'm not sure if I would use it for Windows. Let's see after I installed the drivers, which will probably drive me mad.

But be aware that there are clicking sounds when the card is first intialized. If you want to use it for e.g. system sounds, you may not be very happy with that. They also seem to appear during heavy disk access (apt-get dist-upgrade), even if I'm not playing any music. That's definitely weird...

The microphone input works flawlessly. I didn't have problems with over-amplification, though I can imagine that being an issue with the lack of hardware mixing. And I definitely have a sound card for surround sound HD movie nights now. And the crazy thing is I can do it all perfectly with my little netbook. Thank you, Linux. Thanks also to you, Mandar.

Post Scriptum
Some additional information for nerds: When the card is not in use, it produces not wakes in powertop, when in use, it produces about 200-300 wakes/s (no matter if surround or stereo sound).

Update
The clicking sound seems to be related to the power supply. The problem disappears in the same work load (e.g. heavy disk updatedb) if I plug the power adapter into my netbook.

Update2
As I almost expected the device is not anywhere as good in Windows as in Linux. The crystalizer does sound nice, but there are many glitches in the Windows driver. E.g.

  • sometimes when you pause they playback, the result is a constant beep until you press play again, 
  • during forwarding in movies, there are short beeps. 
  • Once after removing the plug and putting it back inside, the entire system hung, only working again after removing it again and then showing and error message. 
  • the driver uses much more CPU than in Linux and it's a 50 MB package
  • there are no volume controls for rear, center, lfe and front channels, only 1 master control (in Linux you can fix this -- maybe MatrixMixer works for Windows?)
  • the microphone input sounds slightly noise shaped, esp. in combination with the "crystalizer"
Hence I would make my recommendation more clear: I wouldn't recommend it for surround sound in Windows I think. It might still be your best option due to the lack of alternatives, though.

And here's my .asoundrc so far:

pcm.!default {
type plug
slave.pcm "softvol" #make use of softvol
}

# create softvol master channel
# see http://alsa.opensrc.org/index.php/How_to_use_softvol_to_control_the_master_volume
pcm.softvol {
type softvol
slave {
pcm "dmixer2" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Master" #override the PCM slider to set the softvol volume level globally
card S51
}
}

# create stereo dmixer, because using the 6 channel one causes stutter if the channels are empty
pcm.dmixer2 {
type dmix
ipc_key 2343
slave {
pcm "hw:S51"
channels 2
}
}

pcm.dmixer6 {
type dmix
ipc_key 2342
slave {
pcm "hw:S51"
rate 48000
channels 6
period_time 0
period_size 1024
buffer_time 0
buffer_size 4096
}
}

# reroute the channels because rear and sub/lfe are exchanged
pcm.mysurround {
type route
slave.pcm "dmixer6"
slave.channels 6

ttable.0.0 1
ttable.1.1 1
ttable.2.4 1
ttable.3.5 1
ttable.4.2 1
ttable.5.3 1
}
More about → Creative X-fi Surround USB Review and Guide for Ubuntu 9.10 or Newer

Linux Boots Faster!

Diposkan oleh Unknown on Tuesday, November 3, 2009

Check out this live video comparison at TuxRadar:

More about → Linux Boots Faster!

Helping Windows Users with UltraVNC Single Click and ssvnc from Linux

Diposkan oleh Unknown on Thursday, August 14, 2008

If you ever (try to) use UltraVNC Single Click to help Windows users from Linux, you will find out that it's not that easy. Though you can use the UltraVNC viewer in Wine, you may see disconnects after around 15 minutes. The easy solution lies in starting a regular TightVNC with these parameters:

xtightvncviewer -listen 0 -encodings "hextile copyrect"

Replace the 0 with the display number, e.g. 0 for port 5500 or 400 for 5900. (port = 5500 + x) You need to have the package xtightvncviewer installed for this to work in Ubuntu. The color parameter does not work properly in this configuration.

Or give ssvnc a try. It works even with SCIII (uvnc Single Click via SSL), supports different color depths and much more!

And if you've got a current wine version, you might as well use the original ultravnc viewer. It works fine by now.

I usually use ssvn and the following script to start the vnc listener and quit it when finished.
VNC=$HOME/src/ssvnc/bin/tightvncviewer
$VNC -listen 487 -use64 & # 64 colors
read -p "Press enter when finished"
killall tightvncviewer vncviewer
More about → Helping Windows Users with UltraVNC Single Click and ssvnc from Linux

KDE 4.1 in Windows XP SP3

Diposkan oleh Unknown on Sunday, July 20, 2008

I had a little problem when I tried to install KDE 4.1b1 under Windows XP SP3, but was eventually able to fix it by installing the Microsoft Virtual C++ 2005 SP1 redistributable instead of the MSVC++ 2005 one that came with KDE 4.

After that it was amazing to see the KDE applications work pretty well natively under windows. And some KDE software is just really, really good and better than anything else you can get to run on windows.
More about → KDE 4.1 in Windows XP SP3

Opera Speed running under Windows and Linux

Diposkan oleh Unknown on Wednesday, June 18, 2008

I've installed Opera 9.5. It's really nice and I'm actually writing this entry with it right now. But then because of unfortunate resume problems after a BIOS upgrade with my Acer notebook, I've installed and tried the new version in Windows as well.

And frankly, I was amazed. The websites loaded so quickly it seemed they were just there immediately. Awesome work, Opera. But then I started wondering:

Why is Opera so much faster under Windows?

More about → Opera Speed running under Windows and Linux

Detect and Counter ARP Poisoning under Windows and Linux

Diposkan oleh Unknown on Friday, June 6, 2008

It is nowadays simply too easy to manipulate network traffic. There is for example a Chinese Software called Netsense, which makes it so easy, smooth and effortless, the people using it really might not even know it's using illegal techniques. I don't have any idea, though because I don't know what the manual or description says -> I don't speak Chinese.

ARP is the address resolution protocol. It resolves a computer's IP address to a computer's hardware MAC address. ARP poisoning means that one computer(A) claims to be the owner of the IP address of another computer(B). Computer(A) then gets all network traffic destined for that computer(B). This would mean that the computer(B) the network traffic is actually destined to would not get it anymore. Therefore the spying host(A) is usually configured to forward the packages to the actual host(B) after inspecting them.

Now let's see what you can do against ARP Poisoning under Linux.

First let's find out, what's going on. For that purpose wireshark is very helpful. Wireshark displays all network traffic on your interface. For our purposes we do not need to use the promiscuos mode, as we only have to see the packages directed at our machine. If you want to watch for other machines being poisoned you need to activate the promiscous mode. Usually activating it shouldn't hurt, so let's activate it. 

What you will see characteristically is that (1) one hosts keeps announcing its MAC address via ARP without any other hosts actually having asked for it beforehands. Wireshark may detect a duplicate use of IP addresses (3). And the normal ARP resolutions process(2) of a host asking for the IP address and then gettings its answer usually does not happen anymore for that particular address. (1) is called IP spoofing, as a host claims to have an IP address which it actually does not.

Let's see what we can do about it. There are two things you can do. The easy one, which works under Windows as well, is to set the MAC address manually, called static mac assignment. Type in run, or in a console:

arp -s 192.168.0.1 00-12-34-56-78-90
You should replace 192.168.0.1 with the ip address of the host that is constantly shown in (1) and the mac address behind it with the real mac address of that host, which you can either look up manually or if you're lucky, see as in (2), e.g. when the ARP poisoning is not active at the moment.

Under Linux you can often chose a more flexible approach and simply ban the host that is poisoning your machine. Now don't even try using the normal iptables against it, in my tests it had absolutely no effect. But there is a version of it called arptables, which can help you.
sudo arptables -A INPUT -m mac --source-mac ff:ee:dd:cc:bb:aa -j DROP
While ff:ee:dd:cc:bb:aa should be replaced with the mac address of the host that can bee seen as sources mac address in (1). Now the host should not be able to poison your arp table (or communicate with you) anymore at all. Of course you can also just manually set the IP address just as under windows above
sudo arp -s 192.168.0.1 00-12-34-56-78-90
This will still allow the host to communiate with you.

To check what hosts and what mac address are in the arp table simply use
sudo arp

Remember that while the ARP poisoning is active and working, the hosts poisoning your arp table can usually see all your network traffic. This means the host can log and save everything in your network traffic, such as your passwords, emails, instant messages and everything that is not or poorly unencrypted, even some poorly configured online banking pages. It will most probably also have an impact on the connection speed, especially if you're using a wireless network with a bad reception. 

I hope it helped. Any questions or remarks in the comments are welcome.
More about → Detect and Counter ARP Poisoning under Windows and Linux