Стоит дебиан 8й, и нужен аналог socketbind.
Суть на сервере 3 ип, нужно что бы я мог вызывать через консоль определенное приложение и указывать ему через какой ип обращаться к внешнему узлу.
У приложения нет поддержки bind адресов.
как заставить некоторые процессы гонять трафик через виртуальный интерфейс?
нашел тему, но там не до конца решена проблема
Аналог socketbind для линукса
Модераторы: SLEDopit, Модераторы разделов
-
BlackOrWhite
- Сообщения: 12
Re: Аналог socketbind для линукса
Не указал, что socketbind либа под фрибсд...
-
Bizdelnick
- Модератор
- Сообщения: 21502
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Аналог socketbind для линукса
В той теме дали ссылку на libsis, это разве не оно?
Пишите правильно:
| в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
-
BlackOrWhite
- Сообщения: 12
Re: Аналог socketbind для линукса
Ну во первых не очень разобрал как ее верно установить, при запуске майке у меня полезли ошибки, а во вторых This library wraps around the libc functions connect() and sendto(). разве при вызове скрипта через консоль используются эти функции?
-
BlackOrWhite
- Сообщения: 12
Re: Аналог socketbind для линукса
Change to the libsis directory and run make. You should find a file named {.
Set the environment variable LD_PRELOAD to /path/to/libisis/directory/libsis.so:
export LD_PRELOAD=/path…./libsis.so
or if you're using a csh type shell
setenv LD_PRELOAD /path…./libsis.so
then set the environment variable SIS_SOURCE:
export SIS_SOURCE=10.151.2.130
or again in a csh type shell
setenv SIS_SOURCE 10.151.2.130
Note: Only IP Addresses are allowed, no hostnames.
Now call your program and it should have its source address set to $SIS_SOURCE in outgoing connections.
You may want to copy the libsis.so* files to a convinient directory.
Скачиваю запускаю файл и
root@root:~# /home/libsis-0.1.1/Makefile
/home/libsis-0.1.1/Makefile: line 5: -g: команда не найдена
/home/libsis-0.1.1/Makefile: line 6: -lc: команда не найдена
/home/libsis-0.1.1/Makefile: line 8: libsis.so:: команда не найдена
/home/libsis-0.1.1/Makefile: line 9: $@: ambiguous redirect
/home/libsis-0.1.1/Makefile: line 10: libsis.so.0.1:: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: CC: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: CFLARGS: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: LDFLAGS: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: -o: Нет такого файла или каталога
/home/libsis-0.1.1/Makefile: line 12: clean:: команда не найдена
/home/libsis-0.1.1/Makefile: line 13: -rm: команда не найдена
Или что-то делаю не так?
Set the environment variable LD_PRELOAD to /path/to/libisis/directory/libsis.so:
export LD_PRELOAD=/path…./libsis.so
or if you're using a csh type shell
setenv LD_PRELOAD /path…./libsis.so
then set the environment variable SIS_SOURCE:
export SIS_SOURCE=10.151.2.130
or again in a csh type shell
setenv SIS_SOURCE 10.151.2.130
Note: Only IP Addresses are allowed, no hostnames.
Now call your program and it should have its source address set to $SIS_SOURCE in outgoing connections.
You may want to copy the libsis.so* files to a convinient directory.
Скачиваю запускаю файл и
root@root:~# /home/libsis-0.1.1/Makefile
/home/libsis-0.1.1/Makefile: line 5: -g: команда не найдена
/home/libsis-0.1.1/Makefile: line 6: -lc: команда не найдена
/home/libsis-0.1.1/Makefile: line 8: libsis.so:: команда не найдена
/home/libsis-0.1.1/Makefile: line 9: $@: ambiguous redirect
/home/libsis-0.1.1/Makefile: line 10: libsis.so.0.1:: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: CC: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: CFLARGS: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: LDFLAGS: команда не найдена
/home/libsis-0.1.1/Makefile: line 11: -o: Нет такого файла или каталога
/home/libsis-0.1.1/Makefile: line 12: clean:: команда не найдена
/home/libsis-0.1.1/Makefile: line 13: -rm: команда не найдена
Или что-то делаю не так?
-
Bizdelnick
- Модератор
- Сообщения: 21502
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Аналог socketbind для линукса
Во-первых, не надо это делать от рута.
cd libsis-0.1.1
make
cd libsis-0.1.1
make
Пишите правильно:
| в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
-
BlackOrWhite
- Сообщения: 12
Re: Аналог socketbind для линукса
-bash: make: команда не найдена
-
Bizdelnick
- Модератор
- Сообщения: 21502
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Аналог socketbind для линукса
Значит надо установить.
apt-get install make gcc
apt-get install make gcc
Пишите правильно:
| в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
-
BlackOrWhite
- Сообщения: 12
Re: Аналог socketbind для линукса
ЭХ((
я уже подумал щас смогу ее заюзать
Эта либа у меня гаходиться в каталоге хоме или ее лучше перенести?
я уже подумал щас смогу ее заюзать
cc -fPIC -g -O2 -Wall -Werror -c -o sis.o sis.c
sis.c:46:5: error: conflicting types for ‘sendto’
int sendto(SENDTO_SIGNATURE);
^
In file included from sis.c:33:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:163:16: note: previous declaration of ‘sendto’ was here
extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
^
sis.c: In function ‘connect’:
sis.c:80:25: error: pointer targets in passing argument 5 of ‘getsockopt’ differ in signedness [-Werror=pointer-sign]
(void *) &sock_type, &sock_type_len);
^
In file included from sis.c:33:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:219:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘int *’
extern int getsockopt (int __fd, int __level, int __optname,
^
sis.c:90:3: error: implicit declaration of function ‘memset’ [-Werror=implicit-function-declaration]
memset (&my_address, 0, sizeof (my_address));
^
sis.c:90:3: error: incompatible implicit declaration of built-in function ‘memset’ [-Werror]
sis.c: At top level:
sis.c:104:5: error: conflicting types for ‘sendto’
int sendto(SENDTO_SIGNATURE) {
^
In file included from sis.c:33:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:163:16: note: previous declaration of ‘sendto’ was here
extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
^
sis.c: In function ‘sendto’:
sis.c:130:25: error: pointer targets in passing argument 5 of ‘getsockopt’ differ in signedness [-Werror=pointer-sign]
(void *) &sock_type, &sock_type_len);
^
In file included from sis.c:33:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:219:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘int *’
extern int getsockopt (int __fd, int __level, int __optname,
^
sis.c:140:3: error: incompatible implicit declaration of built-in function ‘memset’ [-Werror]
memset (&my_address, 0, sizeof (my_address));
^
cc1: all warnings being treated as errors
<встроенное>: ошибка выполнения рецепта для цели «sis.o»
make: *** [sis.o] Ошибка 1
Эта либа у меня гаходиться в каталоге хоме или ее лучше перенести?
-
Bizdelnick
- Модератор
- Сообщения: 21502
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Аналог socketbind для линукса
Мдя, видимо, многое поменялось с тех пор, как эта штука была написана...
Пишите правильно:
| в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
-
BlackOrWhite
- Сообщения: 12
Re: Аналог socketbind для линукса
есть каки-то аналоги? или только вариант с прокси остаеться?