PDA

View Full Version : [CoD2] Setup CoD2 on your Ubuntu server



IzNoGoD
29th November 2015, 20:34
First off, I'd like to thank any and all sources I've used over the years to gather all this information. I cannot name them individually, however, if you feel special enough that you think you require a listing, send me a PM and I'll put you in my list of special people.


So, first off, you'd need a server with ubuntu x64 minimal (this tutorial should work an all versions between 12.04 and 20.04 without any modification). Any other linux installation might also work (debian is closesly related to ubuntu, so the steps listed here will probably work on a debian install as well) (CentOS is not that closely related so most steps will require changing). Aquiring such a server is a thing you have to figure out for yourself. You can buy one of the many VPS's (virtual private servers) or run linux locally (on your own server/inside a VM/on your main pc) and go from there.


Step 1: Securing your server

The first steps you should always take when running any internet-facing server is securing the server. The most common attack vector for internet facing servers is ssh root password bruteforcing (clicky (https://blog.sucuri.net/2013/07/ssh-brute-force-the-10-year-old-attack-that-still-persists.html)), so moving away from both password usage for ssh logon as well as root login is a valid first step. Basically, it involves you following this guide: guide is here (https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04) (choose your ubuntu version at the top right of that page, defaults to 14.04). If you're really paranoid about security you might want to generate your public/private key file on your local pc instead of on your server, use puttygen (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).

The next step in securing your ssh login is putting it on a different port. By default ssh listens on port 22, on ANY ssh installation. This means that portscans/brute force attacks will try port 22 first. Changing your ssh port basically boils down to editting /etc/ssh/sshd_config and changing the Port 22 line to some other port, preferably above 1024, but it must be below 65536 (I'm using a port between 30000 and 40000). Hereafter you have to restart your ssh deamon (ubuntu: service ssh restart) and reconnect your client on the new port.

After this, you should configure a firewall (example here (https://www.digitalocean.com/community/tutorials/additional-recommended-steps-for-new-ubuntu-14-04-servers)). Keep in mind that changing your ssh port requires you to actually read the stuff at that link or you might lock yourself out of your server.

Step 2: Installing CoD2 prerequisites
CoD2 prerequisites are as easy as doing:


sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install libstdc++5:i386

Although I'm not 100% sure that covers ALL the prerequisites. If cod fails to run, try installing the libcod prerequisites (step 4) as well.

IzNoGoD
29th November 2015, 20:37
Step 3: Installing CoD2
Installing cod2 is as simple as uploading the lnxded file (see another thread here on killtube (http://killtube.org/showthread.php?1719-Latest-cod2-linux-binaries-%281-0-1-2-1-3%29) for the binary files) to, for example, /home/USERNAME/_bin/cod2/cod2_lnxded_1_3 . This needs at least file permissions 500, (read+execute for the owner, assuming you're gonna run this under your own username) so


chmod 500 cod2_lnxded_1_3


Then you need to upload the corresponding main directory to your server (note: main directories differ between v1.0/1.2/1.3) to, for example, /home/USERNAME/_stock/cod2_1_3/main/
These files need to be readable by the useraccount that will start the server

Step 4 (optional): Installing libcod prerequisites
As copied from the libcod github:


sudo apt-get -y install gcc-multilib
sudo apt-get -y install libmysqlclient-dev:i386
sudo apt-get -y install g++-multilib

I've tried installing these all in one command, but that failed for some unknown reasons. So just keep these as separate commands.

Step 5 (optional): compiling libcod from source
In order to compile libcod, you first need to obtain the source code. There are currently multiple libcod versions out there:
Kung foo man's original version (https://github.com/kungfooman/libcod)
Mitch's version (https://github.com/M-itch/libcod) which is a bit more experimental and has a few more features than the original version
Php's version (https://github.com/riicchhaarrd/libcod) has a few nice functions but seems to be out-of-date
voron00's version (https://github.com/voron00/libcod) which seems to be the best maintained version currently

To obtain the code, either download the source from github and upload, or


sudo apt-get install git
git clone [github url here]


You can then easily compile the stuff with


./doit.sh clean
./doit.sh base
./doit.sh cod2_1_3

For different cod versions, change the last line.
The final product (the actual libcod "executable") is then inside the bin folder as libcod2_1_3.so

Step 6: Starting your CoD2 server
Create a .sh file with the following contents:


#!/bin/bash

sv_maxclients="32"
fs_game="your_mod_folder_here"
fs_homepath="/home/USER_HERE/YOUR_COD_DIR"
cod="/full/path/to/cod2_1_3_lnxded"
com_hunkMegs="256"
config="configfile.cfg"
net_port="28960"


args=\
"+set fs_homepath \"$fs_homepath\" "\
"+set fs_game $fs_game "\
"+set net_port $net_port "\
"+set com_hunkMegs $com_hunkMegs "\
"+set sv_maxclients $sv_maxclients "\
"+set fs_basepath \"$fs_homepath\" "\
"+exec $config"

$cod $args +set g_gametype tdm +map mp_toujane
Adjust where required.

Then, start your server with:


./filename.sh
To keep your server running after you leave the ssh session, use screen:


screen -AmdS somename
screen -x somename
./filename.sh

Step 7 (optional): Starting your CoD2 server with libcod
Requires a few small edits to your .sh file:


#!/bin/bash

sv_maxclients="32"
fs_game="your_mod_folder_here"
fs_homepath="/home/USER_HERE/YOUR_COD_DIR"
cod="/full/path/to/cod2_1_3_lnxded"
com_hunkMegs="256"
config="configfile.cfg"
cracked="1"
net_port="28960"


args=\
"+set fs_homepath \"$fs_homepath\" "\
"+set sv_cracked $cracked "\
"+set fs_game $fs_game "\
"+set net_port $net_port "\
"+set com_hunkMegs $com_hunkMegs "\
"+set sv_maxclients $sv_maxclients "\
"+set fs_basepath \"$fs_homepath\" "\
"+exec $config"

LD_PRELOAD="relative/path/to/libcod2_1_3.so" $cod $args +set g_gametype tdm +map mp_toujane

Step 8: Creating your first mod
work in progress

Step 9: Protecting your server
Update: Since a few months a patch has been added to both Mitch's github repo as wel as voron00's. The next passage is not applicable to any who use an updated libcod version from the aforementioned sources.

To prevent your server from being used as a ddos amplifier (http://blog.alejandronolla.com/2013/08/05/amplification-ddos-attack-with-quake3-servers-an-analysis-2-slash-2/), you have to apply some iptables rules. As you should have iptables installed from the previous steps already, you can skip right to the protection part. Create a file called anti_ddos in /etc/init.d with the following contents:


#!/bin/bash

# Carry out specific functions when asked to by the system
case "$1" in
start)
iptables -N QUERY-BLOCK
iptables -A QUERY-BLOCK -m recent --set --name blocked-hosts -j DROP
iptables -N QUERY-CHECK
iptables -A QUERY-CHECK -p udp -m string ! --string "getstatus" --algo bm --from 32 --to 41 -j RETURN
iptables -A QUERY-CHECK -p udp --sport 0:1025 -j DROP
iptables -A QUERY-CHECK -p udp --sport 3074 -j DROP
iptables -A QUERY-CHECK -p udp --sport 7777 -j DROP
iptables -A QUERY-CHECK -p udp --sport 8002 -j DROP
iptables -A QUERY-CHECK -p udp --sport 27015:27100 -j DROP
iptables -A QUERY-CHECK -p udp --sport 25200 -j DROP
iptables -A QUERY-CHECK -p udp --sport 25565 -j DROP
iptables -A QUERY-CHECK -m recent --update --name blocked-hosts --seconds 30 --hitcount 1 -j DROP
iptables -A QUERY-CHECK -m hashlimit --hashlimit-mode srcip --hashlimit-name getstatus --hashlimit-above 5/second -j QUERY-BLOCK
iptables -A INPUT -p udp --dport 28960 -j QUERY-CHECK
;;
stop)
exit 0
;;
*)
echo "Usage: /etc/init.d/anti_ddos {start|stop}"
exit 1
;;
esac

exit 0


To protect more than just the default port, edit this line:


iptables -A INPUT -p udp --dport 28960 -j QUERY-CHECK
into something like:

iptables -A INPUT -p udp --dport 28960:28970 -j QUERY-CHECK

This will limit the amount of queries to 5/second per client which should be plenty for normal queries and should temper or block all ddos amplifications.

Save this file, chmod 500 it, and add it to bootup with


sudo update-rc.d anti_ddos defaults

Check if it works by doing:


service anti_ddos start

twice. If you see "chain already exists" you did everything right.
Step 10: Go make something awesome
work in progress

IzNoGoD
29th November 2015, 20:37
(reserved)

Ni3ls
30th November 2015, 02:01
Really looking forward to all info

IzNoGoD
28th February 2016, 17:07
Updated, only step 10 missing now

rgl12
7th March 2018, 18:13
Maybe Im dumb, or I dont know.

I've uploaded main files, ive downloaded cod2_lnxded_1_3_cracked.zip
My folder looks like this
home/cod2server/cod2_lnxded_1_3
home/cod2server/main/dedicated.cfg
home/cod2server/main/(here al iw files as normal)

I have paste and verify this command in putty:

iptables -I INPUT -p UDP --sport 20700 -s cod2master.activision.com -j REJECT

of course i've installed all packages by this command:

sudo apt-get install mailutils postfix curl wget file bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc tmux libstdc++6

and after all this I wanted to finally start cod server by this command:

./cod2_lnxded_1_3_cracked +set +exec dedicated.cfg

and nothing happens - my server is not working :/

here is my cfg:
sets _ADMIN "rogales"
sets _EMAIL "rogaldinho@gmail.com"
sets _IRC ""
sets _WEBSITE ""
sets _LOCATION "Poland"
set sv_hostname "Zjednoczone Chlejtuny Jebane"
set scr_motd "Witaj na serwerze. Wymagamy napierdalania i przeklinania!"
set net_ip "194.182.71.250"
set net_port "28960"
set dedicated "2"
set rconpassword "huj"
set sv_pure "1"
set sv_maxplayers "20"
set sv_minping "0"
set sv_maxping "0"
set sv_maxrate "0"
set sv_voice "0"
set g_password ""
set sv_drawfriend "0"
set scr_friendlyfire "0"
set scr_forcerespawn "1"
set scr_killcam "1"
set g_allowvote "1"
set scr_teambalance "1"
set scr_spectateenemy "0"
set scr_spectatefree "0"
set scr_allow_bar "1"
set scr_allow_bren "1"
set scr_allow_enfield "1"
set scr_allow_enfieldsniper "1"
set scr_allow_g43 "1"
set scr_allow_greasegun "1"
set scr_allow_kar98k "1"
set scr_allow_kar98ksniper "1"
set scr_allow_m1carbine "1"
set scr_allow_m1garand "1"
set scr_allow_mp40 "1"
set scr_allow_mp44 "1"
set scr_allow_nagant "1"
set scr_allow_nagantsniper "1"
set scr_allow_pps42 "1"
set scr_allow_ppsh "1"
set scr_allow_shotgun "1"
set scr_allow_springfield "1"
set scr_allow_sten "1"
set scr_allow_svt40 "1"
set scr_allow_thompson "1"
set scr_allow_fraggrenades "1"
set scr_allow_smokegrenades "1"
set scr_ctf_scorelimit "5"
set scr_ctf_timelimit "30"
set scr_dm_scorelimit "50"
set scr_dm_timelimit "30"
set scr_sd_bombtimer "60"
set scr_sd_graceperiod "15"
set scr_sd_roundlength "4"
set scr_sd_roundlimit "0"
set scr_sd_scorelimit "50"
set scr_sd_timelimit "30"
set scr_tdm_scorelimit "100"
set scr_tdm_timelimit "30"
set scr_hq_scorelimit "450"
set scr_hq_timelimit "30"
set sv_mapRotationCurrent ""
sv_maprotation "gametype dm map mp_breakout gametype dm map mp_brecourt gametype dm map mp_burgundy gametype dm map mp_carentan gametype dm map mp_dawnville gametype dm map mp_decoy gametype dm map mp_downtown gametype dm map mp_farmhouse gametype dm map mp_leningrad gametype dm map mp_matmata gametype dm map mp_railyard gametype dm map mp_toujane gametype dm map mp_trainstation gametype tdm map mp_breakout gametype tdm map mp_brecourt gametype tdm map mp_burgundy gametype tdm map mp_carentan gametype tdm map mp_dawnville gametype tdm map mp_decoy gametype tdm map mp_downtown gametype tdm map mp_farmhouse gametype tdm map mp_leningrad gametype tdm map mp_matmata gametype tdm map mp_railyard gametype tdm map mp_toujane gametype tdm map mp_trainstation gametype sd map mp_breakout gametype sd map mp_brecourt gametype sd map mp_burgundy gametype sd map mp_carentan gametype sd map mp_dawnville gametype sd map mp_decoy gametype sd map mp_downtown gametype sd map mp_farmhouse gametype sd map mp_leningrad gametype sd map mp_matmata gametype sd map mp_railyard gametype sd map mp_toujane gametype sd map mp_trainstation gametype ctf map mp_breakout gametype ctf map mp_brecourt gametype ctf map mp_burgundy gametype ctf map mp_carentan gametype ctf map mp_dawnville gametype ctf map mp_decoy gametype ctf map mp_downtown gametype ctf map mp_farmhouse gametype ctf map mp_leningrad gametype ctf map mp_matmata gametype ctf map mp_railyard gametype ctf map mp_toujane gametype ctf map mp_trainstation gametype hq map mp_breakout gametype hq map mp_brecourt gametype hq map mp_burgundy gametype hq map mp_carentan gametype hq map mp_dawnville gametype hq map mp_decoy gametype hq map mp_downtown gametype hq map mp_farmhouse gametype hq map mp_leningrad gametype hq map mp_matmata gametype hq map mp_railyard gametype hq map mp_toujane gametype hq map mp_trainstation"
map_rotate

kung foo man
7th March 2018, 18:44
What do you see in Putty? Just select everything with mouse to copy the text automatically and post it here in [code]-tag

rgl12
7th March 2018, 19:39
What do you see in Putty? Just select everything with mouse to copy the text automatically and post it here in [code]-tag

this:

https://i.imgur.com/x4pvdH6.png

and this:


https://i.imgur.com/lnoWJWw.png

kung foo man
7th March 2018, 20:16
Do step 3



chmod 500 ./cod2_lnxded_1_3_cracked


or just



chmod +x ./cod2_lnxded_1_3_cracked

rgl12
7th March 2018, 20:22
Ok.
Now I got this.


root@rgl:/home# cd cod2server
root@rgl:/home/cod2server# chmod 500 ./cod2_lnxded_1_3_cracked
root@rgl:/home/cod2server# chmod +x ./cod2_lnxded_1_3_cracked
root@rgl:/home/cod2server# ./cod2_lnxded_1_3_cracked +set +exec dedicated.cfg
./cod2_lnxded_1_3_cracked: line 1: !DOCTYPE: No such file or directory
./cod2_lnxded_1_3_cracked: line 2: html: No such file or directory
./cod2_lnxded_1_3_cracked: line 3: head: No such file or directory
./cod2_lnxded_1_3_cracked: line 4: title: No such file or directory
./cod2_lnxded_1_3_cracked: line 5: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 6: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 7: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 8: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 9: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 10: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 11: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 12: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 13: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 14: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 15: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 16: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 17: link: No such file or directory
./cod2_lnxded_1_3_cracked: line 18: $'\r': command not found
./cod2_lnxded_1_3_cracked: line 19: syntax error near unexpected token `<'
./cod2_lnxded_1_3_cracked: line 19: ` <link rel='stylesheet' href='/w ro/viewjs-e44544f03b22fab45334dcdb8a6b3b0931e845ad.css' /><script src='/wro/view js-b5af86fa1522edfe99ee6c9472e53cc88f2dc9a5.js' type='text/javascript'></script> 'script type="text/javascript">
root@rgl:/home/cod2server#

kung foo man
7th March 2018, 20:34
Your executable is a HTML file, just click on the download and wait till the download dialog appears, "right click -> save as" doesn't work for forum downloads

rgl12
7th March 2018, 21:01
Ok, I see that with every new post, we're goin further! ;)


root@rgl:/home/cod2server# ./cod2_lnxded_1_3_cracked +set +exec dedicated.cfg
CoD2 MP 1.3 build linux-i386 Jun 23 2006
USAGE: set <variable> <value>
----- FS_Startup -----
Current language: english
Current search path:
/root/.callofduty2/main
/home/cod2server/main/iw_15.iwd (85 files)
/home/cod2server/main/iw_14.iwd (4038 files)
/home/cod2server/main/iw_13.iwd (22624 files)
/home/cod2server/main/iw_12.iwd (1016 files)
/home/cod2server/main/iw_11.iwd (1462 files)
/home/cod2server/main/iw_10.iwd (1936 files)
/home/cod2server/main/iw_09.iwd (2142 files)
/home/cod2server/main/iw_08.iwd (2723 files)
/home/cod2server/main/iw_07.iwd (3384 files)
/home/cod2server/main/iw_06.iwd (990 files)
/home/cod2server/main/iw_05.iwd (928 files)
/home/cod2server/main/iw_04.iwd (698 files)
/home/cod2server/main/iw_03.iwd (26 files)
/home/cod2server/main/iw_02.iwd (40 files)
/home/cod2server/main/iw_01.iwd (16 files)
/home/cod2server/main/iw_00.iwd (102 files)
/home/cod2server/main
/root/.callofduty2/raw
/root/.callofduty2/raw_shared
/root/.callofduty2/devraw
/root/.callofduty2/devraw_shared
/home/cod2server/raw
/home/cod2server/raw_shared
/home/cod2server/devraw
/home/cod2server/devraw_shared

File Handles:
----------------------
81633 files in iwd files
execing default_localize_mp.cfg
couldn't exec language.cfg
couldn't exec config_mp_server.cfg
USAGE: set <variable> <value>
Opening IP socket: localhost:28960
Hostname: rgl
IP: 194.182.71.250
--- Common Initialization Complete ---
USAGE: set <variable> <value>
execing dedicated.cfg
Cbuf_InsertText overflowed
Hitch warning: 1664 msec frame time


and no one cant connect... :(




EDIT: If it matters, my iw files are polish not english.

kung foo man
7th March 2018, 21:14
Cbuf_InsertText overflowed

looks like your sv_maprotation is too long, just type in "map mp_carentan" e.g. by hand, and check "status" command... probably just no map loaded

rgl12
7th March 2018, 21:22
I just cant believe myself what have I done before.
dedicated.cfg was also a html executable.
Now its ok.
but something is still wrong with premission i guess?


81633 files in iwd files
execing default_localize_mp.cfg
couldn't exec language.cfg
couldn't exec config_mp_server.cfg
USAGE: set <variable> <value>
Opening IP socket: localhost:28960
Hostname: rgl
IP: 194.182.71.250
--- Common Initialization Complete ---
USAGE: set <variable> <value>
execing dedicated.cfg
net_ip is write protected.
net_port is write protected.
dedicated is read only.
Sys_Error: Error during initialization:
Attempted to overrun string in call to va()

IzNoGoD
7th March 2018, 21:51
Nope, your commandline is wrong. Dont "+set +exec something", just "+exec something".

And as said: your map_rotation is too long. Shorten it to something below 1024 characters (preferably under 1k)

rgl12
7th March 2018, 22:16
It works! :)

Now I have a litte bit easy problem i guess

set rconpassword "huj" is not working :/
in console im writing /rcon login huj and I cant do nothing after it :/


Next thing is that after I quit putty, the server also shut down. strange :/

IzNoGoD
7th March 2018, 22:22
It works! :)

Now I have a litte bit easy problem i guess

set rconpassword "huj" is not working :/
in console im writing /rcon login huj and I cant do nothing after it :/


Next thing is that after I quit putty, the server also shut down. strange :/


rcon_password, not rconpassword. There's also a minimum length for it.

Closing putty effectively closes your cod server, so yes, that will close your game as well. Look into "screen" to run it without having to log in.

rgl12
7th March 2018, 22:26
Look into "screen" to run it without having to log in.

I dont understand it ? :/

IzNoGoD
7th March 2018, 22:33
create a new screen session:
screen -AmdS namegoeshere

list all current screen sessions:
screen -ls

attach a running screen session:
screen -x namegoeshere
or
screen -x numbergoeshere (see screen -ls)

detach from a screen session:
press ctrl+a, then ctrl+d


Once you've created a new screen session, attach to it, start your server in there instead. Detach (or close the putty window) and it should keep running.

rgl12
7th March 2018, 23:02
Jesus! How do You know this everything?!
It worked!

Ok guys, I've got last question.
In main folder I have saved different (custom) maps. Now. When I connect it automatically it wants to download it, even when the first map is carentan.
Is there any command on cfg file to put an information to download this map when its loaded by server or by rcon?

and... how long will it take, to see my server on master list?

IzNoGoD
7th March 2018, 23:39
Jesus! How do You know this everything?!
It worked!

Ok guys, I've got last question.
In main folder I have saved different (custom) maps. Now. When I connect it automatically it wants to download it, even when the first map is carentan.
Is there any command on cfg file to put an information to download this map when its loaded by server or by rcon?

and... how long will it take, to see my server on master list?

use the MANYMAPS packer, although there is quite a steep learning curve on that.

Master list: use libcod and dont block the stuff in iptables (or cracked executable), should make it show up quite fast.

Mariusz
8th March 2018, 09:53
Ej, huju o nicku rgl12, mógłbyś przetłumaczyć poniższy cytat?
Dziękuję.


create a new screen session:
screen -AmdS namegoeshere

list all current screen sessions:
screen -ls

attach a running screen session:
screen -x namegoeshere
or
screen -x numbergoeshere (see screen -ls)

detach from a screen session:
press ctrl+a, then ctrl+d


Once you've created a new screen session, attach to it, start your server in there instead. Detach (or close the putty window) and it should keep running.

YuriJurek
8th March 2018, 10:41
Tu nie ma co tłumaczyć xD

rgl12
8th March 2018, 18:11
Damn, I was 100% sure that the problems are over.

Today I've created a server on my friends server, and something is not right. Can You help me, please?


root@TeamSpeak:/home/cod2server# ./cod2_lnxded_1_3_cracked +exec dedicated.cfg CoD2 MP 1.3 build linux-i386 Jun 23 2006
----- FS_Startup -----
Current language: english
Current search path:
/root/.callofduty2/main
/home/cod2server/main/zzz_nodustmod_bynikolas.iwd (32 files)
/home/cod2server/main/time_toujanenight.iwd (12 files)
/home/cod2server/main/mp_warsaw.iwd (16 files)
/home/cod2server/main/mp_tigertown_lib.iwd (87 files)
/home/cod2server/main/mp_powcamp.iwd (22 files)
/home/cod2server/main/mp_omaha.iwd (19 files)
/home/cod2server/main/mp_nightshift.iwd (1434 files)
/home/cod2server/main/mp_neuville.iwd (72 files)
/home/cod2server/main/mp_bastogne.iwd (36 files)
/home/cod2server/main/iw_15.iwd (85 files)
/home/cod2server/main/iw_14.iwd (4038 files)
/home/cod2server/main/iw_13.iwd (22624 files)
/home/cod2server/main/iw_12.iwd (1016 files)
/home/cod2server/main/iw_11.iwd (1462 files)
/home/cod2server/main/iw_10.iwd (1936 files)
/home/cod2server/main/iw_09.iwd (2142 files)
/home/cod2server/main/iw_08.iwd (2723 files)
/home/cod2server/main/iw_07.iwd (3384 files)
/home/cod2server/main/iw_06.iwd (990 files)
/home/cod2server/main/iw_05.iwd (928 files)
/home/cod2server/main/iw_04.iwd (698 files)
/home/cod2server/main/iw_03.iwd (26 files)
/home/cod2server/main/iw_02.iwd (40 files)
/home/cod2server/main/iw_01.iwd (16 files)
/home/cod2server/main/iw_00.iwd (102 files)
/home/cod2server/main
/root/.callofduty2/raw
/root/.callofduty2/raw_shared
/root/.callofduty2/devraw
/root/.callofduty2/devraw_shared
/home/cod2server/raw
/home/cod2server/raw_shared
/home/cod2server/devraw
/home/cod2server/devraw_shared

File Handles:
----------------------
83363 files in iwd files
execing default_localize_mp.cfg
couldn't exec language.cfg
execing config_mp_server.cfg
Opening IP socket: localhost:28960
Hostname: TeamSpeak
IP: 80.211.219.240
--- Common Initialization Complete ---
execing dedicated.cfg
net_ip is write protected.
net_port is write protected.
dedicated is read only.
map_rotate...

"sv_mapRotation" is:"gametype dm gametype tdm map mp_toujane map mp_carentan map mp_railyard "

"sv_mapRotationCurrent" is:""

Setting g_gametype: dm.
Setting g_gametype: tdm.
Setting map: mp_toujane.
------ Server Initialization ------
Server: mp_toujane
----- FS_Startup -----
Current language: polish
Current search path:
/root/.callofduty2/main
/home/cod2server/main/zzz_nodustmod_bynikolas.iwd (32 files)
/home/cod2server/main/time_toujanenight.iwd (12 files)
/home/cod2server/main/mp_warsaw.iwd (16 files)
/home/cod2server/main/mp_tigertown_lib.iwd (87 files)
/home/cod2server/main/mp_powcamp.iwd (22 files)
/home/cod2server/main/mp_omaha.iwd (19 files)
/home/cod2server/main/mp_nightshift.iwd (1434 files)
/home/cod2server/main/mp_neuville.iwd (72 files)
/home/cod2server/main/mp_bastogne.iwd (36 files)
/home/cod2server/main/iw_15.iwd (85 files)
/home/cod2server/main/iw_14.iwd (4038 files)
/home/cod2server/main/iw_13.iwd (22624 files)
/home/cod2server/main/iw_12.iwd (1016 files)
/home/cod2server/main/iw_11.iwd (1462 files)
/home/cod2server/main/iw_10.iwd (1936 files)
/home/cod2server/main/iw_09.iwd (2142 files)
/home/cod2server/main/iw_08.iwd (2723 files)
/home/cod2server/main/iw_07.iwd (3384 files)
/home/cod2server/main/iw_06.iwd (990 files)
/home/cod2server/main/iw_05.iwd (928 files)
/home/cod2server/main/iw_04.iwd (698 files)
/home/cod2server/main/iw_03.iwd (26 files)
/home/cod2server/main/iw_02.iwd (40 files)
/home/cod2server/main/iw_01.iwd (16 files)
/home/cod2server/main/iw_00.iwd (102 files)
/home/cod2server/main
/root/.callofduty2/raw
/root/.callofduty2/raw_shared
/root/.callofduty2/devraw
/root/.callofduty2/devraw_shared
/home/cod2server/raw
/home/cod2server/raw_shared
/home/cod2server/devraw
/home/cod2server/devraw_shared
/home/cod2server/main/localized_polish_iw11.iwd (2 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw10.iwd (420 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw09.iwd (49 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw08.iwd (8 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw07.iwd (1014 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw06.iwd (3110 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw05.iwd (5310 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw04.iwd (6240 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw03.iwd (6580 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw02.iwd (6404 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw01.iwd (5510 files)
localized assets iwd file for polish
/home/cod2server/main/localized_polish_iw00.iwd (4776 files)
localized assets iwd file for polish

File Handles:
----------------------
83363 files in iwd files
WARNING: sound file 'weapons/flak/flak88_fire.wav' used as streamed in alias 'bu mm' and loaded in alias 'Flak88_fire'
WARNING: sound file 'weapons/flak/flak_reload.wav' used as streamed in alias 're load' and loaded in alias 'flak_reload'
------- Game Initialization -------
gamename: Call of Duty 2
gamedate: Jun 23 2006
-----------------------------------
Info string length exceeded
key: 'sv_referencedIwds'
value: '770869368 -1565685860 -1317307968 -149688453 -2025324161 -1502416712 172 2644392 -926604223 181429573 780394069 1101180720 1046874969 1053665859 -1652414 412 '
Info string:
\bg_fallDamageMaxHeight\480\bg_fallDamageMinHeight \256\g_synchronousClients\0\sv _cheats\0\sv_disableClientConsole\0\sv_iwdNames\zz z_nodustmod_bynikolas time_tou janenight mp_warsaw mp_tigertown_lib mp_powcamp mp_omaha mp_nightshift mp_neuvil le mp_bastogne iw_15 iw_14 iw_13 iw_12 iw_11 iw_10 iw_09 iw_08 iw_07 iw_06 iw_05 iw_04 iw_03 iw_02 iw_01 iw_00\sv_iwds\770869368 -1051233573 -1565685860 -131730 7968 -149688453 -2025324161 -1502416712 1722644392 -926604223 181429573 -1449716 526 780394069 -1333623355 -1980843666 1334775335 -621896007 1101180720 104687496 9 1053665859 1842349204 -1652414412 1659111092 -1085686032 -2025394354 178615151 \sv_pure\1\sv_referencedIwdNames\main/zzz_nodustmod_bynikolas main/mp_warsaw ma in/mp_tigertown_lib main/mp_powcamp main/mp_omaha main/mp_nightshift main/mp_neu ville main/mp_bastogne main/iw_15 main/iw_13 main/iw_08 main/iw_07 main/iw_06 ma in/iw_04
-----------------------------------
Hitch warning: 3944 msec frame time
Resolving cod2master.fucker .com
Couldn't resolve address: cod2master.fucker .com

IzNoGoD
8th March 2018, 18:42
Too many iwds on your server.

rgl12
8th March 2018, 18:50
Ok. So.. whats the maximum numer of additional iwds ?

Mariusz
8th March 2018, 19:38
Nie wierz we wszystko co przeczytasz. Komunikat błędu mówi, że masz za dużo paczek, ale to nie znaczy, że naprawdę jest ich za dużo.
Widziałem mod z 12 paczkami o wadze 200MB, a na przykład mój ma 8 paczek bez map i waży 500MB.
Masz błąd albo w paczkach albo w rotacji albo jeszcze coś innego, nie pamiętam, ale wszyscy przez to przechodzą.
Więc nie pytaj tylko spójrz na wszystko jeden, drugi i trzeci raz i w końcu znajdziesz błąd.
Ostatecznie możesz wrócić do stanu, kiedy wszystko działało. Poza tym, w komunikatach błędów ważne jest co jest napisane na końcu czyli na początku, w sensie na dole, bo powyżej na górze wszystko jest nie istotne.
I zmień te wulgarne słowa, bo to wygląda jakbyś innych nie znał.

IzNoGoD
8th March 2018, 21:02
Ok. So.. whats the maximum numer of additional iwds ?

Whichever amount does not make your infostring over 1024 characters long.

Note that iwds with longer names take more space in your infostring, so it might even be worth to rename your iwds to short one-character names, although as a general rule-of-thumb it's ill-advised to put them in the main folder to begin with.

IzNoGoD
8th March 2018, 21:03
Nie wierz we wszystko co przeczytasz. Komunikat błędu mówi, że masz za dużo paczek, ale to nie znaczy, że naprawdę jest ich za dużo.
Widziałem mod z 12 paczkami o wadze 200MB, a na przykład mój ma 8 paczek bez map i waży 500MB.
Masz błąd albo w paczkach albo w rotacji albo jeszcze coś innego, nie pamiętam, ale wszyscy przez to przechodzą.
Więc nie pytaj tylko spójrz na wszystko jeden, drugi i trzeci raz i w końcu znajdziesz błąd.
Ostatecznie możesz wrócić do stanu, kiedy wszystko działało. Poza tym, w komunikatach błędów ważne jest co jest napisane na końcu czyli na początku, w sensie na dole, bo powyżej na górze wszystko jest nie istotne.
I zmień te wulgarne słowa, bo to wygląda jakbyś innych nie znał.

English forum, please speak english.

Mariusz
8th March 2018, 21:33
English forum, please speak english.

Yes, Sir!

rgl12
10th March 2018, 18:18
Hey guys!
I got my cod 2 and cod 4 working :)
But. CoD 2 works only when CoD 4 is off
and CoD4 works only if CoD 2 is off
How can i make two servers working on the same time?

In CoD 4 cfg I've changed the port on 28777 and it did not help :/
any solution?


EDIT:

Ok, +set net_port 28777 did the job :)

Mariusz
10th March 2018, 19:53
I am proud of you. Congratulations! Do you invite us on your servers soon, don't you?

IzNoGoD
14th March 2018, 12:56
Quick update for ubuntu 16.04 and the current libcod version (which doesnt require the gcc-multilib thing anymore):



dpkg --add-architecture i386
apt-get update
apt-get install libstdc++5:i386 libstdc++6:i386 libmysqlclient-dev:i386 g++-multilib git
git clone https://github.com/voron00/libcod
cd libcod
./doit.sh cod2_1_3

Loveboy
10th June 2018, 16:32
Somehow I only can start the server on localhost, but I would like to make the server available for everyone.

When I run the server.sh, console tells me:


Opening IP socket: localhost:28960


I tried to set dedicate to 2, so that the server is for everyone available.
Now the console this


dedicated is read only.

I am not sure if it's an error or warning, but it's still running on localhost.

This is my server.sh (which is inside my CoD2 folder):


#!/bin/bash

cod="/home/CoD2/cod2_lnxded_1_3"

$cod +set dedicated 2 +set fs_game "loveboy" +set com_hunkMegs "256" +set sv_maxclients "16" +exec server.cfg +set g_gametype hq +map_rotate


I also tried to set the net_ip with my real IPv4 address


$cod +set dedicated 2 +set fs_game "loveboy" +set com_hunkMegs "256" +set sv_maxclients "16" +set net_ip "12.34.56.78" +exec server.cfg +set g_gametype hq +map_rotate

but the server crashes.

The error:


Opening IP socket: 12.34.56.78:28960
ERROR: UPD_OpenSocket: bind: Cannot assign requested
Opening IP socket: 12.34.56.78:28961
ERROR: UPD_OpenSocket: bind: Cannot assign requested
Opening IP socket: 12.34.56.78:28962
ERROR: UPD_OpenSocket: bind: Cannot assign requested

... till :28969

Sys_Error: Error during initialization:
Couldn't allocate IP port



I also tried to open port in my firewall


iptables -A INPUT -p udp -d 12.34.56.78 --dport 28960 -m state --state NEW -j ACCEPT


and tried to check it with


iptables -L

and found my new entry (successful), but still same errors.
My opened port disappears when I restart ubuntu.


Does anyone maybe know what to do?

kung foo man
10th June 2018, 17:48
There are 2 pages of google with the same problem, maybe try some: https://www.google.de/search?q=%22ERROR%3A+UPD_OpenSocket%3A+bind%3A+Can not+assign+requested%22

Quick skip for solutions over it was from "put net_ip in .cfg" to "reinstall game" lol

Also show your server.cfg

Also try allow all traffic: https://superuser.com/questions/634469/need-iptables-rule-to-accept-all-incoming-traffic

Or start as root for a test

Loveboy
10th June 2018, 18:48
I tried to allow all traffics with:


iptables -P INPUT ACCEPT


I looked up which ports are in use, and when I start server, this will be list up:


Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
...
udp 1408 0 0.0.0.0:28960 0.0.0.0:* 3345/cod2_lnxded_1_
...

It disappears when server is offline.

The net_ip was already set in my server.cfg.
This is my server.cfg:


set sv_wwwDownload 1
seta sv_wwwBaseURL ""
set sv_wwwDlDisconnected 0
set sv_reconnectlimit 3
set sv_pure 1
set sv_allowDownload 0

sv_hostname "Testserver"
set scr_motd "123456"

sets _Admin ""
sets _Email ""
sets _IRC ""
sets _Website ""
sets _Location ""

set sv_pam "1"
set pam_mode "cb"


set sv_pure "1"
set net_ip "12.34.56.78" //Replaced with my real IPv4 address
set net_port "28960"
set sv_maxclients "16"
set sv_privateClients ""
set sv_maxRate "25000"
set sv_minPing "0"
set sv_maxPing "250"
set g_antilag "0"
set scr_friendlyfire "0"
set scr_killcam "1"
set scr_spectatefree "1"
set scr_spectateenemy "1"
set logfile "1"
set g_logsync "1"
set g_log "games_mp.log"
set scr_teambalance "1"
set sv_cheats "1"
set sv_floodprotect "1"
set sv_fps "20"
set g_deadChat "1"
set sv_disableClientConsole "0"
set g_allowvote "0"
set sv_voice "0"
set sv_voiceQuality ""
set scr_drawfriend "1"


seta sv_gamespy "1"
seta sv_master1 "cod2master.activision.com"
seta sv_master2 "cod2update.activision.com"
seta sv_master3 "master0.gamespy.com"
seta sv_master4 "master1.gamespy.com"



set scr_allow_springfield "1"
set scr_allow_svt40 "1"
set scr_allow_kar98ksniper "1"
set scr_allow_nagantsniper "1"
set scr_allow_enfieldsniper "1"
set scr_allow_enfield "1"
set scr_allow_kar98k "1"
set scr_allow_m1carbine "1"
set scr_allow_m1garand "1"
set scr_allow_g43 "1"
set scr_allow_nagant "1"
set scr_allow_bar "1"
set scr_allow_bren "1"
set scr_allow_mp44 "1"
set scr_allow_ppsh "1"
set scr_allow_mp40 "1"
set scr_allow_sten "1"
set scr_allow_thompson "1"
set scr_allow_pps42 ""
set scr_allow_greasegun ""
set scr_allow_shotgun "1"
set scr_allow_smokegrenades "0"
set scr_allow_fraggrenades "1"

set scr_allow_drop_weapons "0"
set scr_allow_drop_grenades "0"



set scr_dm_scorelimit "50"
set scr_dm_timelimit "30"
set scr_tdm_scorelimit "300"
set scr_tdm_timelimit "30.5"
set scr_sd_graceperiod "15"
set scr_sd_roundlength "4"
set scr_sd_roundlimit "7"
set scr_sd_scorelimit ""
set scr_sd_timelimit "20"
set scr_sd_bombtimer "45"
set scr_ctf_scorelimit "7"
set scr_ctf_timelimit "20"
set scr_hq_scorelimit "50"
set scr_hq_timelimit "30"

set scr_map_vote 1
set scr_map_vote_time 15
set scr_map_vote_replay 1


set sv_mapRotation "gametype hq map mp_toujane"

set sv_maprotationcurrent ""

map_rotate




Edit: [SOLVED]

net_ip 0.0.0.0 fixed my problem.

kambocian
6th December 2020, 00:10
ubuntu@ip-xxx-xx-0-202:~/cod2$ ./cod2_lnxded_1_3_cracked +exec dedicated.cfg
CoD2 MP 1.3 build linux-i386 Jun 23 2006
----- FS_Startup -----
Current language: english
Current search path:
/home/ubuntu/.callofduty2/main
/home/ubuntu/cod2/main/zPAM207.iwd (183 files)
/home/ubuntu/cod2/main/T04.iwd (998 files)
/home/ubuntu/cod2/main/P01.iwd (283 files)
/home/ubuntu/cod2/main/iw_15.iwd (85 files)
/home/ubuntu/cod2/main/iw_14.iwd (4038 files)
/home/ubuntu/cod2/main/iw_13.iwd (22624 files)
/home/ubuntu/cod2/main/iw_12.iwd (1016 files)
/home/ubuntu/cod2/main/iw_11.iwd (1462 files)
/home/ubuntu/cod2/main/iw_10.iwd (1936 files)
/home/ubuntu/cod2/main/iw_09.iwd (2142 files)
/home/ubuntu/cod2/main/iw_08.iwd (2723 files)
/home/ubuntu/cod2/main/iw_07.iwd (3384 files)
/home/ubuntu/cod2/main/iw_06.iwd (990 files)
/home/ubuntu/cod2/main/iw_05.iwd (928 files)
/home/ubuntu/cod2/main/iw_04.iwd (698 files)
/home/ubuntu/cod2/main/iw_03.iwd (26 files)
/home/ubuntu/cod2/main/iw_02.iwd (40 files)
/home/ubuntu/cod2/main/iw_01.iwd (16 files)
/home/ubuntu/cod2/main/iw_00.iwd (102 files)
/home/ubuntu/cod2/main/91420.iwd (211 files)
/home/ubuntu/cod2/main/91020c.iwd (413 files)
/home/ubuntu/cod2/main/111120.iwd (483 files)
/home/ubuntu/cod2/main/102520b.iwd (158 files)
/home/ubuntu/cod2/main
/home/ubuntu/.callofduty2/raw
/home/ubuntu/.callofduty2/raw_shared
/home/ubuntu/.callofduty2/devraw
/home/ubuntu/.callofduty2/devraw_shared
/home/ubuntu/cod2/raw
/home/ubuntu/cod2/raw_shared
/home/ubuntu/cod2/devraw
/home/ubuntu/cod2/devraw_shared
/home/ubuntu/cod2/main/localized_english_iw11.iwd (1 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw10.iwd (414 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw09.iwd (98 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw08.iwd (8 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw07.iwd (1014 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw06.iwd (xx10 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw05.iwd (5xx0 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw04.iwd (6240 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw03.iwd (6580 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw02.iwd (6404 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw01.iwd (5510 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw00.iwd (4764 files)
localized assets iwd file for english


File Handles:
----------------------
84392 files in iwd files
execing default_mp.cfg
couldn't exec language.cfg
execing config_mp_server.cfg
Opening IP socket: localhost:28960
Hostname: ip-xxx-xx-0-202.us-east-2.compute.internal
IP: xxx.xx.0.202
--- Common Initialization Complete ---
execing dedicated.cfg
net_ip is write protected.
net_port is write protected.
dedicated is read only.
map_rotate...

"sv_mapRotation" is:"map mp_carentan"

"sv_mapRotationCurrent" is:""

Setting map: mp_carentan.
g_gametype random is not a valid gametype, defaulting to dm
------ Server Initialization ------
Server: mp_carentan
----- FS_Startup -----
Current language: english
Current search path:
/home/ubuntu/.callofduty2/main
/home/ubuntu/cod2/main/zPAM207.iwd (183 files)
/home/ubuntu/cod2/main/T04.iwd (998 files)
/home/ubuntu/cod2/main/P01.iwd (283 files)
/home/ubuntu/cod2/main/iw_15.iwd (85 files)
/home/ubuntu/cod2/main/iw_14.iwd (4038 files)
/home/ubuntu/cod2/main/iw_13.iwd (22624 files)
/home/ubuntu/cod2/main/iw_12.iwd (1016 files)
/home/ubuntu/cod2/main/iw_11.iwd (1462 files)
/home/ubuntu/cod2/main/iw_10.iwd (1936 files)
/home/ubuntu/cod2/main/iw_09.iwd (2142 files)
/home/ubuntu/cod2/main/iw_08.iwd (2723 files)
/home/ubuntu/cod2/main/iw_07.iwd (3384 files)
/home/ubuntu/cod2/main/iw_06.iwd (990 files)
/home/ubuntu/cod2/main/iw_05.iwd (928 files)
/home/ubuntu/cod2/main/iw_04.iwd (698 files)
/home/ubuntu/cod2/main/iw_03.iwd (26 files)
/home/ubuntu/cod2/main/iw_02.iwd (40 files)
/home/ubuntu/cod2/main/iw_01.iwd (16 files)
/home/ubuntu/cod2/main/iw_00.iwd (102 files)
/home/ubuntu/cod2/main/91420.iwd (211 files)
/home/ubuntu/cod2/main/91020c.iwd (413 files)
/home/ubuntu/cod2/main/111120.iwd (483 files)
/home/ubuntu/cod2/main/102520b.iwd (158 files)
/home/ubuntu/cod2/main
/home/ubuntu/.callofduty2/raw
/home/ubuntu/.callofduty2/raw_shared
/home/ubuntu/.callofduty2/devraw
/home/ubuntu/.callofduty2/devraw_shared
/home/ubuntu/cod2/raw
/home/ubuntu/cod2/raw_shared
/home/ubuntu/cod2/devraw
/home/ubuntu/cod2/devraw_shared
/home/ubuntu/cod2/main/localized_english_iw11.iwd (1 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw10.iwd (414 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw09.iwd (98 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw08.iwd (8 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw07.iwd (1014 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw06.iwd (xx10 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw05.iwd (5xx0 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw04.iwd (6240 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw03.iwd (6580 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw02.iwd (6404 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw01.iwd (5510 files)
localized assets iwd file for english
/home/ubuntu/cod2/main/localized_english_iw00.iwd (4764 files)
localized assets iwd file for english

File Handles:
----------------------
84392 files in iwd files
ERROR: Sound alias file mp_commando_sound.csv: Unknown sound channel 'streamed'; should be auto, auto2d, menu, weapon, voice, item, body, local, music, announcer or shellshock
WARNING: sound file 'doors/door_bunker_close.wav' used as streamed in alias 'mp_v2_bunkerdoorclose' and loaded in alias 'fermportebomb'
WARNING: sound file 'fire/Fire_med_loop02.wav' used as streamed in alias 'fire1' and loaded in alias 'medfire'
------- Game Initialization -------
gamename: Call of Duty 2
gamedate: Jun 23 2006
-----------------------------------
logfile opened on Sun Dec 6 01:03:22 2020

-----------------------------------
Hitch warning: 2968 msec frame time
Resolving cod2master.fucker .com
Couldn't resolve address: cod2master.fucker .com

I'm trying to make it work for hours. I have no idea and i can't see any error message :/ I can't connect to server with ip and address like : /connect xxx.xx.0.202:28960;password xxxxxx It's keep trying forever.


Edit : I solved it. IP was wrong omg sorry for bother :(

IzNoGoD
27th January 2021, 14:03
Thread editted to reflect that this method works on basically any ubuntu version
- 12.04 untested
- 14.04 thoroughly tested (10+ servers running for multiple years)
- 16.04 tested
- 18.04 thoroughly tested (10+ servers running for multiple years)
- 20.04 tested

Barring any major changes in the architecture (dropping 32 bit support for example), this tutorial should work on future versions as well.