{"id":328,"title":"Ubuntu Statik IP ile Route","content":"<h2>Ubuntu&rsquo;da A\u011f Aray&uuml;zlerini G&ouml;r&uuml;nt&uuml;leme ve Statik IP ile Route (Y&ouml;nlendirme)&nbsp;<\/h2>\r\n<p>Bir Ubuntu sunucusunda birden fazla a\u011f aray&uuml;z&uuml; (&ouml;rne\u011fin biri internete, di\u011feri i&ccedil; a\u011fa ba\u011fl\u0131) bulundu\u011funda, do\u011fru yap\u0131land\u0131rma yap\u0131lmad\u0131\u011f\u0131nda ba\u011flant\u0131 sorunlar\u0131, gecikmeler veya &ccedil;ak\u0131\u015fmalar ya\u015fanabilir.<br>Bu yaz\u0131da \u015fu konular\u0131 ele alaca\u011f\u0131z:<\/p>\r\n<ul>\r\n<li>Ubuntu&rsquo;da a\u011f aray&uuml;zlerini (interface) listeleme<\/li>\r\n<li>Belirli bir interface&rsquo;e IP atama<\/li>\r\n<li>Netplan ile kal\u0131c\u0131 yap\u0131land\u0131rma<\/li>\r\n<li>Route (y&ouml;nlendirme) ayarlar\u0131n\u0131 optimize etme<\/li>\r\n<\/ul>\r\n<h1>A\u011f Aray&uuml;zlerini Listeleme<\/h1>\r\n<p>Ubuntu&rsquo;da mevcut a\u011f aray&uuml;zlerini g&ouml;rmek i&ccedil;in en modern y&ouml;ntem:<\/p>\r\n<p><br><code>ip link show<\/code><br><br><\/p>\r\n<p>ya da k\u0131sa haliyle:<\/p>\r\n<p><br><code>ip a<\/code><br><br><\/p>\r\n<p>&Ouml;rnek &ccedil;\u0131kt\u0131:<\/p>\r\n<p><br><code>1: lo: mtu 65536 ...<\/code><br><code>2: ens160: mtu 1500 ...<\/code><br><code>3: ens192: mtu 1500 ...<\/code><br><br><\/p>\r\n<p>Burada:<\/p>\r\n<p>* `lo` &rarr; localhost (loopback)<br>* `ens160` &rarr; aktif Ethernet aray&uuml;z&uuml;<br>* `ens192` &rarr; ikinci Ethernet aray&uuml;z&uuml; (&ouml;rne\u011fin i&ccedil; a\u011f ba\u011flant\u0131s\u0131)<\/p>\r\n<p>Belirli bir interface&rsquo;in detaylar\u0131n\u0131 g&ouml;rmek i&ccedil;in:<\/p>\r\n<p><br><code>ip addr show dev ens160<\/code><\/p>\r\n<h2>Ge&ccedil;ici IP Atama (Test Ama&ccedil;l\u0131)<\/h2>\r\n<p>Bir a\u011f aray&uuml;z&uuml;ne ge&ccedil;ici olarak IP atamak i&ccedil;in (yeniden ba\u015flat\u0131nca kaybolur):<\/p>\r\n<p><br><code>sudo ip link set ens192 up<\/code><br><code>sudo ip addr add 10.100.0.111\/23 dev ens192<\/code><br><br><\/p>\r\n<p>Kontrol etmek i&ccedil;in:<\/p>\r\n<p><br><code>ip a show dev ens192<\/code><\/p>\r\n<blockquote>\r\n<p>Netplan ile Kal\u0131c\u0131 Statik IP Yap\u0131land\u0131rmas\u0131<\/p>\r\n<\/blockquote>\r\n<p>Ubuntu 18.04 ve sonras\u0131nda a\u011f ayarlar\u0131 **Netplan** ile yap\u0131l\u0131r.<br>Netplan dosyas\u0131 genellikle `\/etc\/netplan\/00-installer-config.yaml` konumundad\u0131r.<\/p>\r\n<p>&Ouml;rne\u011fin mevcut sistemde `ens160` i&ccedil;in a\u015fa\u011f\u0131daki yap\u0131 varsa:<\/p>\r\n<p><code>yaml<\/code><br><code>network:<\/code><br><code>&nbsp; ethernets:<\/code><br><code>&nbsp; &nbsp; ens160:<\/code><br><code>&nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; - 10.50.10.111\/24<\/code><br><code>&nbsp; &nbsp; &nbsp; gateway4: 10.50.10.1<\/code><br><code>&nbsp; &nbsp; &nbsp; nameservers:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - 10.50.10.1<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; search: []<\/code><br><code>&nbsp; version: 2<\/code><\/p>\r\n<p>Bunu bozmada, ikinci aray&uuml;z (**ens192**) i&ccedil;in yeni bir IP tan\u0131mlayabiliriz:<\/p>\r\n<p><code>yaml<\/code><br><code>network:<\/code><br><code>&nbsp; version: 2<\/code><br><code>&nbsp; ethernets:<\/code><br><code>&nbsp; &nbsp; ens160:<\/code><br><code>&nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; - 10.50.10.111\/24<\/code><br><code>&nbsp; &nbsp; &nbsp; gateway4: 10.50.10.1<\/code><br><code>&nbsp; &nbsp; &nbsp; nameservers:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - 10.50.10.1<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; search: []<\/code><br><code>&nbsp; &nbsp; ens192:<\/code><br><code>&nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; - 10.100.0.111\/23<\/code><br><br><\/p>\r\n<p>Dosyay\u0131 kaydettikten sonra de\u011fi\u015fiklikleri uygulay\u0131n:<\/p>\r\n<p><br><code>sudo netplan apply<\/code><\/p>\r\n<h2>Route (Y&ouml;nlendirme) Ayarlar\u0131n\u0131 Optimize Etme<\/h2>\r\n<p>E\u011fer iki aray&uuml;z&uuml;n de **gateway** sat\u0131r\u0131 varsa, Ubuntu hangi yolu kullanaca\u011f\u0131n\u0131 kar\u0131\u015ft\u0131rabilir.<br>Bu durumda biri ana &ccedil;\u0131k\u0131\u015f (&ouml;rne\u011fin internete giden), di\u011feri sadece belirli bir a\u011fa ba\u011fl\u0131 olmal\u0131d\u0131r.<\/p>\r\n<p>&Ouml;rne\u011fin:<\/p>\r\n<p><code>`ens160` &rarr; \u0130nternet &ccedil;\u0131k\u0131\u015f\u0131 (10.5.10.0\/24)<\/code><br><code>`ens192` &rarr; \u0130&ccedil; a\u011f (10.100.0.0\/23)<\/code><\/p>\r\n<p>Do\u011fru yap\u0131land\u0131rma \u015f&ouml;yle olmal\u0131d\u0131r:<\/p>\r\n<p><code>yaml<\/code><br><code>network:<\/code><br><code>&nbsp; version: 2<\/code><br><code>&nbsp; ethernets:<\/code><br><code>&nbsp; &nbsp; ens160:<\/code><br><code>&nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; - 10.50.10.111\/24<\/code><br><code>&nbsp; &nbsp; &nbsp; gateway4: 10.50.10.1<\/code><br><code>&nbsp; &nbsp; &nbsp; nameservers:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - 10.50.10.1<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; search: []<\/code><br><code>&nbsp; &nbsp; ens192:<\/code><br><code>&nbsp; &nbsp; &nbsp; addresses:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; - 10.100.0.111\/23<\/code><br><code>&nbsp; &nbsp; &nbsp; routes:<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; - to: 10.100.0.0\/23<\/code><br><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; via: 10.100.0.1<\/code><br><br><\/p>\r\n<h2>A&ccedil;\u0131klama<\/h2>\r\n<p><span style=\"color: rgb(230, 126, 35);\">* `ens160` sistemin ana a\u011f ge&ccedil;idi (internet bu yoldan &ccedil;\u0131kar).<\/span><br><span style=\"color: rgb(230, 126, 35);\">* `ens192` sadece 10.100.0.0\/23 alt a\u011f\u0131ndaki cihazlarla ileti\u015fim kurar.<\/span><\/p>\r\n<p>&nbsp;<\/p>\r\n<p>Kontrol ve Do\u011frulama<\/p>\r\n<p>Ayarlar\u0131 uygulad\u0131ktan sonra do\u011frulamak i&ccedil;in:<\/p>\r\n<p><code>ip route<\/code><\/p>\r\n<p>&Ouml;rnek &ccedil;\u0131kt\u0131:<\/p>\r\n<p><code>default via 10.50.10.1 dev ens160<\/code><br><code>10.100.0.0\/23 via 10.100.0.1 dev ens192<\/code><br><code>10.5.10.0\/24 dev ens160 proto kernel scope link src 10.50.10.111<\/code><br><br><\/p>\r\n<p>Ping testi:<\/p>\r\n<p><code>ping -c 4 10.100.0.1<\/code><\/p>\r\n<ul>\r\n<li>A\u011f aray&uuml;zlerini nas\u0131l g&ouml;r&uuml;nt&uuml;leyece\u011fini,<\/li>\r\n<li>Ge&ccedil;ici ve kal\u0131c\u0131 IP atama y&ouml;ntemlerini,<\/li>\r\n<li>Birden fazla a\u011f aray&uuml;z&uuml; oldu\u011funda y&ouml;nlendirmeyi nas\u0131l optimize edece\u011fini &ouml;\u011frendin.<\/li>\r\n<\/ul>\r\n<p>Do\u011fru route ayarlar\u0131 sayesinde sistemin hem <code>internet ba\u011flant\u0131s\u0131n\u0131<\/code> hem de <code>lokal a\u011f ileti\u015fimini<\/code>&nbsp;sorunsuz bir \u015fekilde s&uuml;rd&uuml;rebilir.<\/p>\r\n<p>&nbsp;<\/p>","excerpt":"Bir Ubuntu sunucusunda birden fazla a\u011f aray\u00fcz\u00fc (\u00f6rne\u011fin biri internete, di\u011feri i\u00e7 a\u011fa ba\u011fl\u0131) bulundu\u011funda, do\u011fru yap\u0131land\u0131rma yap\u0131lmad\u0131\u011f\u0131nda ba\u011flant\u0131 sorunlar\u0131, gecikmeler veya \u00e7ak\u0131\u015fmalar ya\u015fanabilir.","created_at":"2025-10-30 14:41:01","updated_at":"2026-09-06 14:49:08","category_id":6,"view_count":620,"reading_time":3,"status":"published","editor_choice":1,"is_editor_choice":0,"published_at":"2025-10-30 14:41:00","featured_image":"api_pixabay_1762013995_6906332b4597e.jpg","slug":"ubuntu-statik-ip-ile-route","category_name":"Sistem","category_slug":"sistem"}